prebid.js 8.6.0 → 8.8.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 (222) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/a1MediaRtdProvider.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/admaticBidAdapter.js +1 -1
  8. package/dist/adqueryBidAdapter.js +1 -1
  9. package/dist/adqueryIdSystem.js +1 -1
  10. package/dist/adrelevantisBidAdapter.js +1 -1
  11. package/dist/adsinteractiveBidAdapter.js +1 -1
  12. package/dist/adtrgtmeBidAdapter.js +1 -1
  13. package/dist/adxcgBidAdapter.js +1 -1
  14. package/dist/adyoulikeBidAdapter.js +1 -1
  15. package/dist/ajaBidAdapter.js +1 -1
  16. package/dist/alkimiBidAdapter.js +1 -1
  17. package/dist/amxBidAdapter.js +1 -1
  18. package/dist/amxIdSystem.js +1 -1
  19. package/dist/appierAnalyticsAdapter.js +1 -1
  20. package/dist/appnexusBidAdapter.js +1 -1
  21. package/dist/asoBidAdapter.js +1 -1
  22. package/dist/automatadAnalyticsAdapter.js +1 -0
  23. package/dist/axonixBidAdapter.js +1 -1
  24. package/dist/bidViewability.js +1 -1
  25. package/dist/bidglassBidAdapter.js +1 -1
  26. package/dist/big-richmediaBidAdapter.js +1 -1
  27. package/dist/brandmetricsRtdProvider.js +1 -1
  28. package/dist/bridBidAdapter.js +1 -1
  29. package/dist/bridgewellBidAdapter.js +1 -1
  30. package/dist/brightMountainMediaBidAdapter.js +1 -1
  31. package/dist/carodaBidAdapter.js +1 -1
  32. package/dist/chtnwBidAdapter.js +1 -1
  33. package/dist/concertBidAdapter.js +1 -1
  34. package/dist/connatixBidAdapter.js +1 -0
  35. package/dist/connectadBidAdapter.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 +7 -1
  43. package/dist/dspxBidAdapter.js +1 -1
  44. package/dist/eplanningBidAdapter.js +1 -1
  45. package/dist/euidIdSystem.js +1 -1
  46. package/dist/feedadBidAdapter.js +1 -1
  47. package/dist/finativeBidAdapter.js +1 -1
  48. package/dist/freepassBidAdapter.js +1 -1
  49. package/dist/freewheel-sspBidAdapter.js +1 -1
  50. package/dist/geoedgeRtdProvider.js +1 -1
  51. package/dist/gmosspBidAdapter.js +1 -1
  52. package/dist/goldbachBidAdapter.js +1 -1
  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/hypelabBidAdapter.js +1 -1
  59. package/dist/id5IdSystem.js +1 -1
  60. package/dist/imdsBidAdapter.js +1 -1
  61. package/dist/improvedigitalBidAdapter.js +1 -1
  62. package/dist/insticatorBidAdapter.js +1 -1
  63. package/dist/ixBidAdapter.js +1 -1
  64. package/dist/justpremiumBidAdapter.js +1 -1
  65. package/dist/kargoBidAdapter.js +1 -1
  66. package/dist/konduitAnalyticsAdapter.js +1 -1
  67. package/dist/kueezBidAdapter.js +1 -1
  68. package/dist/kueezRtbBidAdapter.js +1 -1
  69. package/dist/kulturemediaBidAdapter.js +1 -1
  70. package/dist/lassoBidAdapter.js +1 -1
  71. package/dist/lifestreetBidAdapter.js +1 -1
  72. package/dist/liveIntentIdSystem.js +1 -1
  73. package/dist/logicadBidAdapter.js +1 -1
  74. package/dist/loglyliftBidAdapter.js +1 -1
  75. package/dist/magniteAnalyticsAdapter.js +1 -1
  76. package/dist/malltvAnalyticsAdapter.js +1 -1
  77. package/dist/marsmediaBidAdapter.js +1 -1
  78. package/dist/mediafuseBidAdapter.js +1 -1
  79. package/dist/medianetBidAdapter.js +1 -1
  80. package/dist/mediasquareBidAdapter.js +1 -1
  81. package/dist/mgidBidAdapter.js +1 -1
  82. package/dist/minutemediaBidAdapter.js +1 -1
  83. package/dist/minutemediaplusBidAdapter.js +1 -1
  84. package/dist/nativoBidAdapter.js +1 -1
  85. package/dist/nexx360BidAdapter.js +1 -1
  86. package/dist/not-for-prod/prebid.js +145 -142
  87. package/dist/oguryBidAdapter.js +1 -1
  88. package/dist/onetagBidAdapter.js +1 -1
  89. package/dist/ooloAnalyticsAdapter.js +1 -1
  90. package/dist/operaadsBidAdapter.js +1 -1
  91. package/dist/operaadsIdSystem.js +1 -0
  92. package/dist/optidigitalBidAdapter.js +1 -1
  93. package/dist/outbrainBidAdapter.js +1 -1
  94. package/dist/oxxionAnalyticsAdapter.js +1 -1
  95. package/dist/parrableIdSystem.js +1 -1
  96. package/dist/pixfutureBidAdapter.js +1 -1
  97. package/dist/prebid-core.js +1 -1
  98. package/dist/publinkIdSystem.js +1 -1
  99. package/dist/pubmaticBidAdapter.js +1 -1
  100. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  101. package/dist/pxyzBidAdapter.js +1 -1
  102. package/dist/quantcastBidAdapter.js +1 -1
  103. package/dist/readpeakBidAdapter.js +1 -1
  104. package/dist/relaidoBidAdapter.js +1 -1
  105. package/dist/retailspotBidAdapter.js +1 -1
  106. package/dist/rhythmoneBidAdapter.js +1 -1
  107. package/dist/riseBidAdapter.js +1 -1
  108. package/dist/rubiconBidAdapter.js +1 -1
  109. package/dist/seedingAllianceBidAdapter.js +1 -1
  110. package/dist/seedtagBidAdapter.js +1 -1
  111. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  112. package/dist/sharethroughBidAdapter.js +1 -1
  113. package/dist/shinezBidAdapter.js +1 -1
  114. package/dist/smaatoBidAdapter.js +1 -1
  115. package/dist/smartadserverBidAdapter.js +1 -1
  116. package/dist/smartxBidAdapter.js +1 -1
  117. package/dist/smartyadsBidAdapter.js +1 -1
  118. package/dist/smilewantedBidAdapter.js +1 -1
  119. package/dist/snigelBidAdapter.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/tappxBidAdapter.js +1 -1
  127. package/dist/targetVideoBidAdapter.js +1 -1
  128. package/dist/teadsBidAdapter.js +1 -1
  129. package/dist/topicsFpdModule.js +1 -1
  130. package/dist/trionBidAdapter.js +1 -1
  131. package/dist/tripleliftBidAdapter.js +1 -1
  132. package/dist/ttdBidAdapter.js +1 -1
  133. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  134. package/dist/uid2IdSystem.js +1 -1
  135. package/dist/underdogmediaBidAdapter.js +1 -1
  136. package/dist/undertoneBidAdapter.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/integrationExamples/topics/topics-server.js +72 -0
  147. package/modules/.submodules.json +2 -1
  148. package/modules/a1MediaRtdProvider.js +1 -1
  149. package/modules/adagioBidAdapter.js +15 -1
  150. package/modules/adgenerationBidAdapter.js +4 -3
  151. package/modules/admaticBidAdapter.js +5 -0
  152. package/modules/adqueryBidAdapter.js +23 -21
  153. package/modules/adqueryIdSystem.js +45 -30
  154. package/modules/adrelevantisBidAdapter.js +2 -0
  155. package/modules/adsinteractiveBidAdapter.js +2 -0
  156. package/modules/alkimiBidAdapter.js +19 -7
  157. package/modules/automatadAnalyticsAdapter.js +325 -0
  158. package/modules/automatadAnalyticsAdapter.md +23 -0
  159. package/modules/bidViewability.js +7 -0
  160. package/modules/bidViewability.md +9 -8
  161. package/modules/brandmetricsRtdProvider.js +30 -27
  162. package/modules/connatixBidAdapter.js +185 -0
  163. package/modules/connatixBidAdapter.md +37 -0
  164. package/modules/criteoBidAdapter.js +73 -50
  165. package/modules/freepassBidAdapter.js +20 -1
  166. package/modules/freepassBidAdapter.md +4 -1
  167. package/modules/geoedgeRtdProvider.js +43 -13
  168. package/modules/geoedgeRtdProvider.md +2 -1
  169. package/modules/gridBidAdapter.js +1 -8
  170. package/modules/liveIntentIdSystem.js +16 -1
  171. package/modules/medianetBidAdapter.js +7 -4
  172. package/modules/mediasquareBidAdapter.js +3 -0
  173. package/modules/nativoBidAdapter.js +21 -3
  174. package/modules/onetagBidAdapter.js +3 -0
  175. package/modules/operaadsBidAdapter.js +5 -0
  176. package/modules/operaadsBidAdapter.md +5 -5
  177. package/modules/operaadsIdSystem.js +106 -0
  178. package/modules/operaadsIdSystem.md +52 -0
  179. package/modules/optidigitalBidAdapter.js +25 -16
  180. package/modules/oxxionAnalyticsAdapter.js +22 -5
  181. package/modules/rubiconBidAdapter.js +2 -2
  182. package/modules/smartyadsBidAdapter.js +18 -1
  183. package/modules/snigelBidAdapter.js +69 -16
  184. package/modules/snigelBidAdapter.md +9 -3
  185. package/modules/tappxBidAdapter.js +17 -14
  186. package/modules/topicsFpdModule.js +35 -9
  187. package/modules/undertoneBidAdapter.md +1 -1
  188. package/modules/userId/eids.md +7 -0
  189. package/modules/visxBidAdapter.js +51 -1
  190. package/package.json +2 -2
  191. package/src/adloader.js +1 -0
  192. package/src/native.js +2 -2
  193. package/test/spec/modules/adagioBidAdapter_spec.js +89 -0
  194. package/test/spec/modules/adgenerationBidAdapter_spec.js +6 -6
  195. package/test/spec/modules/admaticBidAdapter_spec.js +5 -0
  196. package/test/spec/modules/adqueryIdSystem_spec.js +13 -24
  197. package/test/spec/modules/alkimiBidAdapter_spec.js +3 -9
  198. package/test/spec/modules/automatadAnalyticsAdapter_spec.js +533 -0
  199. package/test/spec/modules/bidViewability_spec.js +32 -1
  200. package/test/spec/modules/brandmetricsRtdProvider_spec.js +6 -0
  201. package/test/spec/modules/connatixBidAdapter_spec.js +366 -0
  202. package/test/spec/modules/criteoBidAdapter_spec.js +249 -0
  203. package/test/spec/modules/eids_spec.js +48 -0
  204. package/test/spec/modules/freepassBidAdapter_spec.js +44 -0
  205. package/test/spec/modules/geoedgeRtdProvider_spec.js +44 -24
  206. package/test/spec/modules/gridBidAdapter_spec.js +68 -0
  207. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +5 -0
  208. package/test/spec/modules/liveIntentIdSystem_spec.js +5 -0
  209. package/test/spec/modules/medianetBidAdapter_spec.js +18 -18
  210. package/test/spec/modules/mediasquareBidAdapter_spec.js +5 -0
  211. package/test/spec/modules/nativoBidAdapter_spec.js +6 -1
  212. package/test/spec/modules/onetagBidAdapter_spec.js +69 -0
  213. package/test/spec/modules/operaadsIdSystem_spec.js +53 -0
  214. package/test/spec/modules/optidigitalBidAdapter_spec.js +9 -2
  215. package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +6 -1
  216. package/test/spec/modules/rubiconBidAdapter_spec.js +24 -0
  217. package/test/spec/modules/smartyadsBidAdapter_spec.js +49 -0
  218. package/test/spec/modules/snigelBidAdapter_spec.js +57 -6
  219. package/test/spec/modules/tappxBidAdapter_spec.js +19 -0
  220. package/test/spec/modules/topicsFpdModule_spec.js +102 -1
  221. package/test/spec/modules/visxBidAdapter_spec.js +151 -1
  222. package/test/spec/native_spec.js +5 -3
@@ -0,0 +1,366 @@
1
+ import { expect } from 'chai';
2
+ import {
3
+ spec,
4
+ getBidFloor as connatixGetBidFloor
5
+ } from '../../../modules/connatixBidAdapter.js';
6
+ import { BANNER } from '../../../src/mediaTypes.js';
7
+
8
+ describe('connatixBidAdapter', function () {
9
+ let bid;
10
+
11
+ function mockBidRequest() {
12
+ const mediaTypes = {
13
+ banner: {
14
+ sizes: [16, 9],
15
+ }
16
+ };
17
+ return {
18
+ bidId: 'testing',
19
+ bidder: 'connatix',
20
+ params: {
21
+ placementId: '30e91414-545c-4f45-a950-0bec9308ff22'
22
+ },
23
+ mediaTypes
24
+ };
25
+ };
26
+
27
+ describe('isBidRequestValid', function () {
28
+ this.beforeEach(function () {
29
+ bid = mockBidRequest();
30
+ });
31
+
32
+ it('Should return true if all required fileds are present', function () {
33
+ expect(spec.isBidRequestValid(bid)).to.be.true;
34
+ });
35
+ it('Should return false if bidder does not correspond', function () {
36
+ bid.bidder = 'abc';
37
+ expect(spec.isBidRequestValid(bid)).to.be.false;
38
+ });
39
+ it('Should return false if bidId is missing', function () {
40
+ delete bid.bidId;
41
+ expect(spec.isBidRequestValid(bid)).to.be.false;
42
+ });
43
+ it('Should return false if params object is missing', function () {
44
+ delete bid.params;
45
+ expect(spec.isBidRequestValid(bid)).to.be.false;
46
+ });
47
+ it('Should return false if placementId is missing from params', function () {
48
+ delete bid.params.placementId;
49
+ expect(spec.isBidRequestValid(bid)).to.be.false;
50
+ });
51
+ it('Should return false if mediaTypes is missing', function () {
52
+ delete bid.mediaTypes;
53
+ expect(spec.isBidRequestValid(bid)).to.be.false;
54
+ });
55
+ it('Should return false if banner is missing from mediaTypes ', function () {
56
+ delete bid.mediaTypes.banner;
57
+ expect(spec.isBidRequestValid(bid)).to.be.false;
58
+ });
59
+ it('Should return false if sizes is missing from banner object', function () {
60
+ delete bid.mediaTypes.banner.sizes;
61
+ expect(spec.isBidRequestValid(bid)).to.be.false;
62
+ });
63
+ it('Should return false if sizes is not an array', function () {
64
+ bid.mediaTypes.banner.sizes = 'test';
65
+ expect(spec.isBidRequestValid(bid)).to.be.false;
66
+ });
67
+ it('Should return false if sizes is an empty array', function () {
68
+ bid.mediaTypes.banner.sizes = [];
69
+ expect(spec.isBidRequestValid(bid)).to.be.false;
70
+ });
71
+ it('Should return true if add an extra field was added to the bidRequest', function () {
72
+ bid.params.test = 1;
73
+ expect(spec.isBidRequestValid(bid)).to.be.true;
74
+ });
75
+ });
76
+
77
+ describe('buildRequests', function () {
78
+ let serverRequest;
79
+ let bidderRequest = {
80
+ refererInfo: {
81
+ canonicalUrl: '',
82
+ numIframes: 0,
83
+ reachedTop: true,
84
+ referer: 'http://example.com',
85
+ stack: ['http://example.com']
86
+ },
87
+ gdprConsent: {
88
+ consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
89
+ vendorData: {},
90
+ gdprApplies: true
91
+ },
92
+ uspConsent: '1YYY',
93
+ ortb2: {
94
+ site: {
95
+ data: {
96
+ pageType: 'article'
97
+ }
98
+ }
99
+ }
100
+ };
101
+
102
+ this.beforeEach(function () {
103
+ bid = mockBidRequest();
104
+ serverRequest = spec.buildRequests([bid], bidderRequest);
105
+ })
106
+
107
+ it('Creates a ServerRequest object with method, URL and data', function () {
108
+ expect(serverRequest).to.exist;
109
+ expect(serverRequest.method).to.exist;
110
+ expect(serverRequest.url).to.exist;
111
+ expect(serverRequest.data).to.exist;
112
+ });
113
+ it('Returns POST method', function () {
114
+ expect(serverRequest.method).to.equal('POST');
115
+ });
116
+ it('Returns valid URL', function () {
117
+ expect(serverRequest.url).to.equal('https://capi.connatix.com/rtb/hba');
118
+ });
119
+ it('Returns request payload', function () {
120
+ expect(serverRequest.data).to.not.empty;
121
+ });
122
+ it('Validate request payload', function () {
123
+ expect(serverRequest.data.bidRequests[0].bidId).to.equal(bid.bidId);
124
+ expect(serverRequest.data.bidRequests[0].placementId).to.equal(bid.params.placementId);
125
+ expect(serverRequest.data.bidRequests[0].floor).to.equal(0);
126
+ expect(serverRequest.data.bidRequests[0].mediaTypes).to.equal(bid.mediaTypes);
127
+ expect(serverRequest.data.bidRequests[0].sizes).to.equal(bid.mediaTypes.sizes);
128
+ expect(serverRequest.data.refererInfo).to.equal(bidderRequest.refererInfo);
129
+ expect(serverRequest.data.gdprConsent).to.equal(bidderRequest.gdprConsent);
130
+ expect(serverRequest.data.uspConsent).to.equal(bidderRequest.uspConsent);
131
+ expect(serverRequest.data.ortb2).to.equal(bidderRequest.ortb2);
132
+ });
133
+ });
134
+
135
+ describe('interpretResponse', function () {
136
+ const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
137
+ const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
138
+ const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
139
+
140
+ let serverResponse;
141
+ this.beforeEach(function () {
142
+ serverResponse = {
143
+ body: {
144
+ CustomerId,
145
+ PlayerId,
146
+ Bids: [ Bid ]
147
+ },
148
+ headers: function() { }
149
+ };
150
+ });
151
+
152
+ it('Should return an empty array if Bids is null', function () {
153
+ serverResponse.body.Bids = null;
154
+
155
+ const response = spec.interpretResponse(serverResponse);
156
+ expect(response).to.be.an('array').that.is.empty;
157
+ });
158
+
159
+ it('Should return an empty array if Bids is empty array', function () {
160
+ serverResponse.body.Bids = [];
161
+ const response = spec.interpretResponse(serverResponse);
162
+ expect(response).to.be.an('array').that.is.empty;
163
+ });
164
+
165
+ it('Should return an empty array if CustomerId is null', function () {
166
+ serverResponse.body.CustomerId = null;
167
+ const response = spec.interpretResponse(serverResponse);
168
+ expect(response).to.be.an('array').that.is.empty;
169
+ });
170
+
171
+ it('Should return an empty array if PlayerId is null', function () {
172
+ serverResponse.body.PlayerId = null;
173
+ const response = spec.interpretResponse(serverResponse);
174
+ expect(response).to.be.an('array').that.is.empty;
175
+ });
176
+
177
+ it('Should return one bid response for one bid', function() {
178
+ const bidResponses = spec.interpretResponse(serverResponse);
179
+ expect(bidResponses.length).to.equal(1);
180
+ });
181
+
182
+ it('Should contains the same values as in the serverResponse', function() {
183
+ const bidResponses = spec.interpretResponse(serverResponse);
184
+
185
+ const [ bidResponse ] = bidResponses;
186
+ expect(bidResponse.requestId).to.equal(serverResponse.body.Bids[0].RequestId);
187
+ expect(bidResponse.cpm).to.equal(serverResponse.body.Bids[0].Cpm);
188
+ expect(bidResponse.ttl).to.equal(serverResponse.body.Bids[0].Ttl);
189
+ expect(bidResponse.currency).to.equal('USD');
190
+ expect(bidResponse.mediaType).to.equal(BANNER);
191
+ expect(bidResponse.netRevenue).to.be.true;
192
+ });
193
+
194
+ it('Should return n bid responses for n bids', function() {
195
+ serverResponse.body.Bids = [ { ...Bid }, { ...Bid } ];
196
+
197
+ const firstBidCpm = 4;
198
+ serverResponse.body.Bids[0].Cpm = firstBidCpm;
199
+
200
+ const secondBidCpm = 13;
201
+ serverResponse.body.Bids[1].Cpm = secondBidCpm;
202
+
203
+ const bidResponses = spec.interpretResponse(serverResponse);
204
+ expect(bidResponses.length).to.equal(2);
205
+
206
+ expect(bidResponses[0].cpm).to.equal(firstBidCpm);
207
+ expect(bidResponses[1].cpm).to.equal(secondBidCpm);
208
+ });
209
+ });
210
+
211
+ describe('getUserSyncs', function() {
212
+ const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
213
+ const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
214
+ const UserSyncEndpoint = 'https://connatix.com/sync'
215
+ const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
216
+
217
+ const serverResponse = {
218
+ body: {
219
+ CustomerId,
220
+ PlayerId,
221
+ UserSyncEndpoint,
222
+ Bids: [ Bid ]
223
+ },
224
+ headers: function() { }
225
+ };
226
+
227
+ it('Should return an empty array when iframeEnabled: false', function () {
228
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [], {}, {}, {})).to.be.an('array').that.is.empty;
229
+ });
230
+ it('Should return an empty array when serverResponses is emprt array', function () {
231
+ expect(spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [], {}, {}, {})).to.be.an('array').that.is.empty;
232
+ });
233
+ it('Should return an empty array when iframeEnabled: true but serverResponses in an empty array', function () {
234
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [serverResponse], {}, {}, {})).to.be.an('array').that.is.empty;
235
+ });
236
+ it('Should return an empty array when iframeEnabled: true but serverResponses in an not defined or null', function () {
237
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, undefined, {}, {}, {})).to.be.an('array').that.is.empty;
238
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, null, {}, {}, {})).to.be.an('array').that.is.empty;
239
+ });
240
+ it('Should return one user sync object when iframeEnabled is true and serverResponses is not an empry array', function () {
241
+ expect(spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [serverResponse], {}, {}, {})).to.be.an('array').that.is.not.empty;
242
+ });
243
+ it('Should return a list containing a single object having type: iframe and url: syncUrl', function () {
244
+ const userSyncList = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [serverResponse], undefined, undefined, undefined);
245
+ const { type, url } = userSyncList[0];
246
+ expect(type).to.equal('iframe');
247
+ expect(url).to.equal(UserSyncEndpoint);
248
+ });
249
+ it('Should append gdpr: 0 if gdprConsent object is provided but gdprApplies field is not provided', function () {
250
+ const userSyncList = spec.getUserSyncs(
251
+ {iframeEnabled: true, pixelEnabled: true},
252
+ [serverResponse],
253
+ {},
254
+ undefined,
255
+ undefined
256
+ );
257
+ const { url } = userSyncList[0];
258
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=0`);
259
+ });
260
+ it('Should append gdpr having the value of gdprApplied if gdprConsent object is present and have gdprApplies field', function () {
261
+ const userSyncList = spec.getUserSyncs(
262
+ {iframeEnabled: true, pixelEnabled: true},
263
+ [serverResponse],
264
+ {gdprApplies: true},
265
+ undefined,
266
+ undefined
267
+ );
268
+ const { url } = userSyncList[0];
269
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1`);
270
+ });
271
+ it('Should append gdpr_consent if gdprConsent object is present and have gdprApplies field', function () {
272
+ const userSyncList = spec.getUserSyncs(
273
+ {iframeEnabled: true, pixelEnabled: true},
274
+ [serverResponse],
275
+ {gdprApplies: true, consentString: 'alabala'},
276
+ undefined,
277
+ undefined
278
+ );
279
+ const { url } = userSyncList[0];
280
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=alabala`);
281
+ });
282
+ it('Should encodeURI gdpr_consent corectly', function () {
283
+ const userSyncList = spec.getUserSyncs(
284
+ {iframeEnabled: true, pixelEnabled: true},
285
+ [serverResponse],
286
+ {gdprApplies: true, consentString: 'test&2'},
287
+ undefined,
288
+ undefined
289
+ );
290
+ const { url } = userSyncList[0];
291
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262`);
292
+ });
293
+ it('Should append usp_consent to the url if uspConsent is provided', function () {
294
+ const userSyncList = spec.getUserSyncs(
295
+ {iframeEnabled: true, pixelEnabled: true},
296
+ [serverResponse],
297
+ {gdprApplies: true, consentString: 'test&2'},
298
+ '1YYYN',
299
+ undefined
300
+ );
301
+ const { url } = userSyncList[0];
302
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262&us_privacy=1YYYN`);
303
+ });
304
+ it('Should not modify the sync url if gppConsent param is provided', function () {
305
+ const userSyncList = spec.getUserSyncs(
306
+ {iframeEnabled: true, pixelEnabled: true},
307
+ [serverResponse],
308
+ {gdprApplies: true, consentString: 'test&2'},
309
+ '1YYYN',
310
+ {consent: '1'}
311
+ );
312
+ const { url } = userSyncList[0];
313
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262&us_privacy=1YYYN`);
314
+ });
315
+ });
316
+
317
+ describe('getBidFloor', function () {
318
+ this.beforeEach(function () {
319
+ bid = mockBidRequest();
320
+ });
321
+
322
+ it('Should return 0 if both getFloor method and bidfloor param from bid are absent.', function () {
323
+ const floor = connatixGetBidFloor(bid);
324
+ expect(floor).to.equal(0);
325
+ });
326
+
327
+ it('Should return the value of the bidfloor parameter if the getFloor method is not defined but the bidfloor parameter is defined', function () {
328
+ const floorValue = 3;
329
+ bid.params.bidfloor = floorValue;
330
+
331
+ const floor = connatixGetBidFloor(bid);
332
+ expect(floor).to.equal(floorValue);
333
+ });
334
+
335
+ it('Should return the value of the getFloor method if the getFloor method is defined but the bidfloor parameter is not defined', function () {
336
+ const floorValue = 7;
337
+ bid.getFloor = function() {
338
+ return { floor: floorValue };
339
+ };
340
+
341
+ const floor = connatixGetBidFloor(bid);
342
+ expect(floor).to.equal(floorValue);
343
+ });
344
+
345
+ it('Should return the value of the getFloor method if both getFloor method and bidfloor parameter are defined', function () {
346
+ const floorParamValue = 3;
347
+ bid.params.bidfloor = floorParamValue;
348
+
349
+ const floorMethodValue = 7;
350
+ bid.getFloor = function() {
351
+ return { floor: floorMethodValue };
352
+ };
353
+
354
+ const floor = connatixGetBidFloor(bid);
355
+ expect(floor).to.equal(floorMethodValue);
356
+ });
357
+
358
+ it('Should return 0 if the getFloor method is defined and it crash when call it', function () {
359
+ bid.getFloor = function() {
360
+ throw new Error('error');
361
+ };
362
+ const floor = connatixGetBidFloor(bid);
363
+ expect(floor).to.equal(0);
364
+ });
365
+ });
366
+ });
@@ -217,15 +217,36 @@ describe('The Criteo bidding adapter', function () {
217
217
  }
218
218
  getCookieStub.callsFake(cookieName => cookieData[cookieName]);
219
219
  setCookieStub.callsFake((cookieName, value, expires) => cookieData[cookieName] = value);
220
+ getDataFromLocalStorageStub.callsFake(name => lsData[name]);
220
221
  removeDataFromLocalStorageStub.callsFake(name => lsData[name] = '');
221
222
  spec.onDataDeletionRequest([]);
222
223
  expect(getCookieStub.calledOnce).to.equal(true);
223
224
  expect(setCookieStub.calledOnce).to.equal(true);
225
+ expect(getDataFromLocalStorageStub.calledOnce).to.equal(true);
224
226
  expect(removeDataFromLocalStorageStub.calledOnce).to.equal(true);
225
227
  expect(cookieData.cto_bundle).to.equal('');
226
228
  expect(lsData.cto_bundle).to.equal('');
227
229
  expect(ajaxStub.calledOnce).to.equal(true);
228
230
  });
231
+
232
+ it('should not call API when calling onDataDeletionRequest with no id', () => {
233
+ const cookieData = {
234
+ 'cto_bundle': ''
235
+ };
236
+ const lsData = {
237
+ 'cto_bundle': ''
238
+ }
239
+ getCookieStub.callsFake(cookieName => cookieData[cookieName]);
240
+ setCookieStub.callsFake((cookieName, value, expires) => cookieData[cookieName] = value);
241
+ getDataFromLocalStorageStub.callsFake(name => lsData[name]);
242
+ removeDataFromLocalStorageStub.callsFake(name => lsData[name] = '');
243
+ spec.onDataDeletionRequest([]);
244
+ expect(getCookieStub.calledOnce).to.be.true;
245
+ expect(setCookieStub.called).to.be.false;
246
+ expect(getDataFromLocalStorageStub.calledOnce).to.be.true
247
+ expect(removeDataFromLocalStorageStub.called).to.be.false;
248
+ expect(ajaxStub.called).to.be.false;
249
+ });
229
250
  });
230
251
 
231
252
  describe('isBidRequestValid', function () {
@@ -682,6 +703,33 @@ describe('The Criteo bidding adapter', function () {
682
703
  expect(ortbRequest.source.tid).to.equal('abc');
683
704
  });
684
705
 
706
+ it('should properly transmit bidId if available', function () {
707
+ const bidderRequest = {
708
+ ortb2: {
709
+ source: {
710
+ tid: 'abc'
711
+ }
712
+ }
713
+ };
714
+ const bidRequests = [
715
+ {
716
+ bidId: 'bidId',
717
+ bidder: 'criteo',
718
+ adUnitCode: 'bid-123',
719
+ transactionId: 'transaction-123',
720
+ mediaTypes: {
721
+ banner: {
722
+ sizes: [[728, 90]]
723
+ }
724
+ },
725
+ params: {}
726
+ },
727
+ ];
728
+ const request = spec.buildRequests(bidRequests, bidderRequest);
729
+ const ortbRequest = request.data;
730
+ expect(ortbRequest.slots[0].slotid).to.equal('bidId');
731
+ });
732
+
685
733
  it('should properly build a request if refererInfo is not provided', function () {
686
734
  const bidderRequest = {};
687
735
  const bidRequests = [
@@ -1865,6 +1913,11 @@ describe('The Criteo bidding adapter', function () {
1865
1913
  bidRequests: [{
1866
1914
  adUnitCode: 'test-requestId',
1867
1915
  bidId: 'test-bidId',
1916
+ mediaTypes: {
1917
+ banner: {
1918
+ sizes: [[728, 90]]
1919
+ }
1920
+ },
1868
1921
  params: {
1869
1922
  networkId: 456,
1870
1923
  }
@@ -1883,6 +1936,202 @@ describe('The Criteo bidding adapter', function () {
1883
1936
  expect(bids[0].meta.networkName).to.equal('Criteo');
1884
1937
  });
1885
1938
 
1939
+ it('should properly parse a bid response with a networkId with twin ad unit banner win', function () {
1940
+ const response = {
1941
+ body: {
1942
+ slots: [{
1943
+ impid: 'test-requestId',
1944
+ cpm: 1.23,
1945
+ creative: 'test-ad',
1946
+ creativecode: 'test-crId',
1947
+ width: 728,
1948
+ height: 90,
1949
+ deal: 'myDealCode',
1950
+ adomain: ['criteo.com'],
1951
+ ext: {
1952
+ meta: {
1953
+ networkName: 'Criteo'
1954
+ }
1955
+ }
1956
+ }],
1957
+ },
1958
+ };
1959
+ const request = {
1960
+ bidRequests: [{
1961
+ adUnitCode: 'test-requestId',
1962
+ bidId: 'test-bidId',
1963
+ mediaTypes: {
1964
+ video: {
1965
+ context: 'instream',
1966
+ mimes: ['video/mpeg'],
1967
+ playerSize: [640, 480],
1968
+ protocols: [5, 6],
1969
+ maxduration: 30,
1970
+ api: [1, 2]
1971
+ }
1972
+ },
1973
+ params: {
1974
+ networkId: 456,
1975
+ },
1976
+ }, {
1977
+ adUnitCode: 'test-requestId',
1978
+ bidId: 'test-bidId2',
1979
+ mediaTypes: {
1980
+ banner: {
1981
+ sizes: [[728, 90]]
1982
+ }
1983
+ },
1984
+ params: {
1985
+ networkId: 456,
1986
+ }
1987
+ }]
1988
+ };
1989
+ const bids = spec.interpretResponse(response, request);
1990
+ expect(bids).to.have.lengthOf(1);
1991
+ expect(bids[0].requestId).to.equal('test-bidId2');
1992
+ expect(bids[0].cpm).to.equal(1.23);
1993
+ expect(bids[0].ad).to.equal('test-ad');
1994
+ expect(bids[0].creativeId).to.equal('test-crId');
1995
+ expect(bids[0].width).to.equal(728);
1996
+ expect(bids[0].height).to.equal(90);
1997
+ expect(bids[0].dealId).to.equal('myDealCode');
1998
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('criteo.com');
1999
+ expect(bids[0].meta.networkName).to.equal('Criteo');
2000
+ });
2001
+
2002
+ it('should properly parse a bid response with a networkId with twin ad unit video win', function () {
2003
+ const response = {
2004
+ body: {
2005
+ slots: [{
2006
+ impid: 'test-requestId',
2007
+ bidId: 'abc123',
2008
+ cpm: 1.23,
2009
+ displayurl: 'http://test-ad',
2010
+ width: 728,
2011
+ height: 90,
2012
+ zoneid: 123,
2013
+ video: true,
2014
+ ext: {
2015
+ meta: {
2016
+ networkName: 'Criteo'
2017
+ }
2018
+ }
2019
+ }],
2020
+ },
2021
+ };
2022
+ const request = {
2023
+ bidRequests: [{
2024
+ adUnitCode: 'test-requestId',
2025
+ bidId: 'test-bidId',
2026
+ mediaTypes: {
2027
+ video: {
2028
+ context: 'instream',
2029
+ mimes: ['video/mpeg'],
2030
+ playerSize: [728, 90],
2031
+ protocols: [5, 6],
2032
+ maxduration: 30,
2033
+ api: [1, 2]
2034
+ }
2035
+ },
2036
+ params: {
2037
+ networkId: 456,
2038
+ },
2039
+ }, {
2040
+ adUnitCode: 'test-requestId',
2041
+ bidId: 'test-bidId2',
2042
+ mediaTypes: {
2043
+ banner: {
2044
+ sizes: [[728, 90]]
2045
+ }
2046
+ },
2047
+ params: {
2048
+ networkId: 456,
2049
+ }
2050
+ }]
2051
+ };
2052
+ const bids = spec.interpretResponse(response, request);
2053
+ expect(bids).to.have.lengthOf(1);
2054
+ expect(bids[0].requestId).to.equal('test-bidId');
2055
+ expect(bids[0].cpm).to.equal(1.23);
2056
+ expect(bids[0].vastUrl).to.equal('http://test-ad');
2057
+ expect(bids[0].mediaType).to.equal(VIDEO);
2058
+ });
2059
+
2060
+ it('should properly parse a bid response with a networkId with twin ad unit native win', function () {
2061
+ const response = {
2062
+ body: {
2063
+ slots: [{
2064
+ impid: 'test-requestId',
2065
+ cpm: 1.23,
2066
+ creative: 'test-ad',
2067
+ creativecode: 'test-crId',
2068
+ width: 728,
2069
+ height: 90,
2070
+ deal: 'myDealCode',
2071
+ adomain: ['criteo.com'],
2072
+ native: {
2073
+ 'products': [{
2074
+ 'sendTargetingKeys': false,
2075
+ 'title': 'Product title',
2076
+ 'description': 'Product desc',
2077
+ 'price': '100',
2078
+ 'click_url': 'https://product.click',
2079
+ 'image': {
2080
+ 'url': 'https://publisherdirect.criteo.com/publishertag/preprodtest/creative.png',
2081
+ 'height': 300,
2082
+ 'width': 300
2083
+ },
2084
+ 'call_to_action': 'Try it now!'
2085
+ }],
2086
+ 'advertiser': {
2087
+ 'description': 'sponsor',
2088
+ 'domain': 'criteo.com',
2089
+ 'logo': { 'url': 'https://www.criteo.com/images/criteo-logo.svg', 'height': 300, 'width': 300 }
2090
+ },
2091
+ 'privacy': {
2092
+ 'optout_click_url': 'https://info.criteo.com/privacy/informations',
2093
+ 'optout_image_url': 'https://static.criteo.net/flash/icon/nai_small.png',
2094
+ },
2095
+ 'impression_pixels': [{ 'url': 'https://my-impression-pixel/test/impression' }, { 'url': 'https://cas.com/lg.com' }]
2096
+ },
2097
+ ext: {
2098
+ meta: {
2099
+ networkName: 'Criteo'
2100
+ }
2101
+ }
2102
+ }],
2103
+ },
2104
+ };
2105
+ const request = {
2106
+ bidRequests: [{
2107
+ adUnitCode: 'test-requestId',
2108
+ bidId: 'test-bidId',
2109
+ mediaTypes: {
2110
+ native: {}
2111
+ },
2112
+ params: {
2113
+ networkId: 456,
2114
+ },
2115
+ }, {
2116
+ adUnitCode: 'test-requestId',
2117
+ bidId: 'test-bidId2',
2118
+ mediaTypes: {
2119
+ banner: {
2120
+ sizes: [[728, 90]]
2121
+ }
2122
+ },
2123
+ params: {
2124
+ networkId: 456,
2125
+ }
2126
+ }]
2127
+ };
2128
+ const bids = spec.interpretResponse(response, request);
2129
+ expect(bids).to.have.lengthOf(1);
2130
+ expect(bids[0].requestId).to.equal('test-bidId');
2131
+ expect(bids[0].cpm).to.equal(1.23);
2132
+ expect(bids[0].mediaType).to.equal(NATIVE);
2133
+ });
2134
+
1886
2135
  it('should properly parse a bid response with a zoneId', function () {
1887
2136
  const response = {
1888
2137
  body: {