prebid.js 8.5.0 → 8.7.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 (203) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adqueryBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adsinteractiveBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/ajaBidAdapter.js +1 -1
  13. package/dist/alkimiBidAdapter.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/automatadAnalyticsAdapter.js +1 -0
  20. package/dist/axonixBidAdapter.js +1 -1
  21. package/dist/bidglassBidAdapter.js +1 -1
  22. package/dist/big-richmediaBidAdapter.js +1 -1
  23. package/dist/bridBidAdapter.js +1 -1
  24. package/dist/bridgewellBidAdapter.js +1 -1
  25. package/dist/brightMountainMediaBidAdapter.js +1 -1
  26. package/dist/carodaBidAdapter.js +1 -1
  27. package/dist/chtnwBidAdapter.js +1 -1
  28. package/dist/concertBidAdapter.js +1 -1
  29. package/dist/connatixBidAdapter.js +1 -0
  30. package/dist/connectadBidAdapter.js +1 -1
  31. package/dist/consumableBidAdapter.js +1 -1
  32. package/dist/conversantAnalyticsAdapter.js +1 -1
  33. package/dist/conversantBidAdapter.js +1 -1
  34. package/dist/craftBidAdapter.js +1 -1
  35. package/dist/criteoBidAdapter.js +1 -1
  36. package/dist/cwireBidAdapter.js +1 -1
  37. package/dist/dependencies.json +6 -0
  38. package/dist/dspxBidAdapter.js +1 -1
  39. package/dist/eplanningBidAdapter.js +1 -1
  40. package/dist/euidIdSystem.js +1 -1
  41. package/dist/feedadBidAdapter.js +1 -1
  42. package/dist/finativeBidAdapter.js +1 -1
  43. package/dist/freepassBidAdapter.js +1 -1
  44. package/dist/freewheel-sspBidAdapter.js +1 -1
  45. package/dist/gmosspBidAdapter.js +1 -1
  46. package/dist/goldbachBidAdapter.js +1 -1
  47. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  48. package/dist/greenbidsRtdProvider.js +1 -1
  49. package/dist/gridBidAdapter.js +1 -1
  50. package/dist/growthCodeAnalyticsAdapter.js +1 -1
  51. package/dist/gumgumBidAdapter.js +1 -1
  52. package/dist/h12mediaBidAdapter.js +1 -1
  53. package/dist/hypelabBidAdapter.js +1 -1
  54. package/dist/id5IdSystem.js +1 -1
  55. package/dist/imdsBidAdapter.js +1 -1
  56. package/dist/improvedigitalBidAdapter.js +1 -1
  57. package/dist/insticatorBidAdapter.js +1 -1
  58. package/dist/ixBidAdapter.js +1 -1
  59. package/dist/justpremiumBidAdapter.js +1 -1
  60. package/dist/kargoBidAdapter.js +1 -1
  61. package/dist/konduitAnalyticsAdapter.js +1 -1
  62. package/dist/kueezBidAdapter.js +1 -1
  63. package/dist/kueezRtbBidAdapter.js +1 -1
  64. package/dist/kulturemediaBidAdapter.js +1 -1
  65. package/dist/lassoBidAdapter.js +1 -1
  66. package/dist/lifestreetBidAdapter.js +1 -1
  67. package/dist/logicadBidAdapter.js +1 -1
  68. package/dist/loglyliftBidAdapter.js +1 -1
  69. package/dist/magniteAnalyticsAdapter.js +1 -1
  70. package/dist/malltvAnalyticsAdapter.js +1 -1
  71. package/dist/marsmediaBidAdapter.js +1 -1
  72. package/dist/mediafuseBidAdapter.js +1 -1
  73. package/dist/medianetBidAdapter.js +1 -1
  74. package/dist/mediasquareBidAdapter.js +1 -1
  75. package/dist/mgidBidAdapter.js +1 -1
  76. package/dist/minutemediaBidAdapter.js +1 -1
  77. package/dist/minutemediaplusBidAdapter.js +1 -1
  78. package/dist/mspa.js +1 -1
  79. package/dist/newspassidBidAdapter.js +1 -1
  80. package/dist/nexx360BidAdapter.js +1 -1
  81. package/dist/not-for-prod/prebid.js +140 -136
  82. package/dist/oguryBidAdapter.js +1 -1
  83. package/dist/onetagBidAdapter.js +1 -1
  84. package/dist/ooloAnalyticsAdapter.js +1 -1
  85. package/dist/optidigitalBidAdapter.js +1 -1
  86. package/dist/outbrainBidAdapter.js +1 -1
  87. package/dist/parrableIdSystem.js +1 -1
  88. package/dist/pixfutureBidAdapter.js +1 -1
  89. package/dist/prebid-core.js +1 -1
  90. package/dist/pubCircleBidAdapter.js +1 -0
  91. package/dist/publinkIdSystem.js +1 -1
  92. package/dist/pubmaticBidAdapter.js +1 -1
  93. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  94. package/dist/pxyzBidAdapter.js +1 -1
  95. package/dist/quantcastBidAdapter.js +1 -1
  96. package/dist/readpeakBidAdapter.js +1 -1
  97. package/dist/relaidoBidAdapter.js +1 -1
  98. package/dist/relevadRtdProvider.js +1 -1
  99. package/dist/retailspotBidAdapter.js +1 -1
  100. package/dist/rhythmoneBidAdapter.js +1 -1
  101. package/dist/riseBidAdapter.js +1 -1
  102. package/dist/rubiconBidAdapter.js +1 -1
  103. package/dist/seedingAllianceBidAdapter.js +1 -1
  104. package/dist/seedtagBidAdapter.js +1 -1
  105. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  106. package/dist/sharethroughBidAdapter.js +1 -1
  107. package/dist/shinezBidAdapter.js +1 -1
  108. package/dist/smaatoBidAdapter.js +1 -1
  109. package/dist/smartadserverBidAdapter.js +1 -1
  110. package/dist/smartxBidAdapter.js +1 -1
  111. package/dist/smilewantedBidAdapter.js +1 -1
  112. package/dist/sonobiBidAdapter.js +1 -1
  113. package/dist/sovrnAnalyticsAdapter.js +1 -1
  114. package/dist/sovrnBidAdapter.js +1 -1
  115. package/dist/ssmasBidAdapter.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/tappxBidAdapter.js +1 -1
  120. package/dist/targetVideoBidAdapter.js +1 -1
  121. package/dist/teadsBidAdapter.js +1 -1
  122. package/dist/topicsFpdModule.js +1 -1
  123. package/dist/trionBidAdapter.js +1 -1
  124. package/dist/tripleliftBidAdapter.js +1 -1
  125. package/dist/ttdBidAdapter.js +1 -1
  126. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  127. package/dist/uid2IdSystem.js +1 -1
  128. package/dist/underdogmediaBidAdapter.js +1 -1
  129. package/dist/undertoneBidAdapter.js +1 -1
  130. package/dist/viantOrtbBidAdapter.js +1 -0
  131. package/dist/vidazooBidAdapter.js +1 -1
  132. package/dist/videobyteBidAdapter.js +1 -1
  133. package/dist/videojsVideoProvider.js +1 -1
  134. package/dist/visxBidAdapter.js +1 -1
  135. package/dist/vuukleBidAdapter.js +1 -1
  136. package/dist/widespaceBidAdapter.js +1 -1
  137. package/dist/winrBidAdapter.js +1 -1
  138. package/dist/yahoosspBidAdapter.js +1 -1
  139. package/dist/yieldmoBidAdapter.js +1 -1
  140. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  141. package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +1 -1
  142. package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +1 -1
  143. package/integrationExamples/videoModule/jwplayer/bidsBackHandlerOverride.html +137 -0
  144. package/integrationExamples/videoModule/jwplayer/eventListeners.html +1 -1
  145. package/integrationExamples/videoModule/jwplayer/eventsUI.html +1 -1
  146. package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +1 -1
  147. package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +1 -1
  148. package/integrationExamples/videoModule/jwplayer/playlist.html +1 -1
  149. package/integrationExamples/videoModule/videojs/bidsBackHandlerOverride.html +164 -0
  150. package/libraries/mspa/activityControls.js +51 -32
  151. package/modules/adagioBidAdapter.js +15 -1
  152. package/modules/adgenerationBidAdapter.js +5 -4
  153. package/modules/adsinteractiveBidAdapter.js +4 -2
  154. package/modules/alkimiBidAdapter.js +19 -7
  155. package/modules/appnexusBidAdapter.js +1 -1
  156. package/modules/automatadAnalyticsAdapter.js +325 -0
  157. package/modules/automatadAnalyticsAdapter.md +23 -0
  158. package/modules/connatixBidAdapter.js +185 -0
  159. package/modules/connatixBidAdapter.md +37 -0
  160. package/modules/criteoBidAdapter.js +18 -0
  161. package/modules/cwireBidAdapter.js +19 -0
  162. package/modules/freepassBidAdapter.js +20 -1
  163. package/modules/freepassBidAdapter.md +4 -1
  164. package/modules/gridBidAdapter.js +1 -8
  165. package/modules/growthCodeAnalyticsAdapter.js +7 -2
  166. package/modules/medianetBidAdapter.js +7 -4
  167. package/modules/mediasquareBidAdapter.js +3 -0
  168. package/modules/newspassid.md +76 -0
  169. package/modules/newspassidBidAdapter.js +44 -18
  170. package/modules/optidigitalBidAdapter.js +25 -16
  171. package/modules/pubCircleBidAdapter.js +231 -0
  172. package/modules/pubCircleBidAdapter.md +79 -0
  173. package/modules/relevadRtdProvider.js +6 -7
  174. package/modules/ssmasBidAdapter.js +2 -2
  175. package/modules/tappxBidAdapter.js +27 -15
  176. package/modules/tappxBidAdapter.md +17 -0
  177. package/modules/topicsFpdModule.js +21 -48
  178. package/modules/undertoneBidAdapter.md +1 -1
  179. package/modules/userId/eids.md +7 -0
  180. package/modules/viantOrtbBidAdapter.js +113 -0
  181. package/modules/viantOrtbBidAdapter.md +54 -0
  182. package/modules/vidazooBidAdapter.js +9 -2
  183. package/modules/videojsVideoProvider.js +9 -2
  184. package/package.json +1 -1
  185. package/test/spec/libraries/mspa/activityControls_spec.js +145 -212
  186. package/test/spec/modules/adagioBidAdapter_spec.js +89 -0
  187. package/test/spec/modules/adgenerationBidAdapter_spec.js +6 -6
  188. package/test/spec/modules/alkimiBidAdapter_spec.js +3 -9
  189. package/test/spec/modules/appnexusBidAdapter_spec.js +12 -1
  190. package/test/spec/modules/automatadAnalyticsAdapter_spec.js +533 -0
  191. package/test/spec/modules/connatixBidAdapter_spec.js +366 -0
  192. package/test/spec/modules/criteoBidAdapter_spec.js +52 -3
  193. package/test/spec/modules/cwireBidAdapter_spec.js +47 -0
  194. package/test/spec/modules/freepassBidAdapter_spec.js +44 -0
  195. package/test/spec/modules/gridBidAdapter_spec.js +68 -0
  196. package/test/spec/modules/medianetBidAdapter_spec.js +18 -18
  197. package/test/spec/modules/mediasquareBidAdapter_spec.js +5 -0
  198. package/test/spec/modules/newspassidBidAdapter_spec.js +6 -0
  199. package/test/spec/modules/optidigitalBidAdapter_spec.js +9 -2
  200. package/test/spec/modules/pubCircleBidAdapter_spec.js +399 -0
  201. package/test/spec/modules/tappxBidAdapter_spec.js +19 -0
  202. package/test/spec/modules/topicsFpdModule_spec.js +343 -365
  203. package/test/spec/modules/viantOrtbBidAdapter_spec.js +432 -0
@@ -915,24 +915,24 @@ let VALID_BID_REQUEST = [{
915
915
  cid: '8CUV090'
916
916
  }
917
917
  },
918
- VALID_PARAMS_AAX = {
919
- bidder: 'aax',
918
+ VALID_PARAMS_TS = {
919
+ bidder: 'trustedstack',
920
920
  params: {
921
- cid: 'AAXG123'
921
+ cid: 'TS012345'
922
922
  }
923
923
  },
924
924
  PARAMS_MISSING = {
925
925
  bidder: 'medianet',
926
926
  },
927
- PARAMS_MISSING_AAX = {
928
- bidder: 'aax',
927
+ PARAMS_MISSING_TS = {
928
+ bidder: 'trustedstack',
929
929
  },
930
930
  PARAMS_WITHOUT_CID = {
931
931
  bidder: 'medianet',
932
932
  params: {}
933
933
  },
934
- PARAMS_WITHOUT_CID_AAX = {
935
- bidder: 'aax',
934
+ PARAMS_WITHOUT_CID_TS = {
935
+ bidder: 'trustedstack',
936
936
  params: {}
937
937
  },
938
938
  PARAMS_WITH_INTEGER_CID = {
@@ -941,8 +941,8 @@ let VALID_BID_REQUEST = [{
941
941
  cid: 8867587
942
942
  }
943
943
  },
944
- PARAMS_WITH_INTEGER_CID_AAX = {
945
- bidder: 'aax',
944
+ PARAMS_WITH_INTEGER_CID_TS = {
945
+ bidder: 'trustedstack',
946
946
  params: {
947
947
  cid: 8867587
948
948
  }
@@ -953,8 +953,8 @@ let VALID_BID_REQUEST = [{
953
953
  cid: ''
954
954
  }
955
955
  },
956
- PARAMS_WITH_EMPTY_CID_AAX = {
957
- bidder: 'aax',
956
+ PARAMS_WITH_EMPTY_CID_TS = {
957
+ bidder: 'trustedstack',
958
958
  params: {
959
959
  cid: ''
960
960
  }
@@ -1783,34 +1783,34 @@ describe('Media.net bid adapter', function () {
1783
1783
  });
1784
1784
  });
1785
1785
 
1786
- describe('isBidRequestValid aax', function () {
1786
+ describe('isBidRequestValid trustedstack', function () {
1787
1787
  it('should accept valid bid params', function () {
1788
- let isValid = spec.isBidRequestValid(VALID_PARAMS_AAX);
1788
+ let isValid = spec.isBidRequestValid(VALID_PARAMS_TS);
1789
1789
  expect(isValid).to.equal(true);
1790
1790
  });
1791
1791
 
1792
1792
  it('should reject bid if cid is not present', function () {
1793
- let isValid = spec.isBidRequestValid(PARAMS_WITHOUT_CID_AAX);
1793
+ let isValid = spec.isBidRequestValid(PARAMS_WITHOUT_CID_TS);
1794
1794
  expect(isValid).to.equal(false);
1795
1795
  });
1796
1796
 
1797
1797
  it('should reject bid if cid is not a string', function () {
1798
- let isValid = spec.isBidRequestValid(PARAMS_WITH_INTEGER_CID_AAX);
1798
+ let isValid = spec.isBidRequestValid(PARAMS_WITH_INTEGER_CID_TS);
1799
1799
  expect(isValid).to.equal(false);
1800
1800
  });
1801
1801
 
1802
1802
  it('should reject bid if cid is a empty string', function () {
1803
- let isValid = spec.isBidRequestValid(PARAMS_WITH_EMPTY_CID_AAX);
1803
+ let isValid = spec.isBidRequestValid(PARAMS_WITH_EMPTY_CID_TS);
1804
1804
  expect(isValid).to.equal(false);
1805
1805
  });
1806
1806
 
1807
1807
  it('should have missing params', function () {
1808
- let isValid = spec.isBidRequestValid(PARAMS_MISSING_AAX);
1808
+ let isValid = spec.isBidRequestValid(PARAMS_MISSING_TS);
1809
1809
  expect(isValid).to.equal(false);
1810
1810
  });
1811
1811
  });
1812
1812
 
1813
- describe('interpretResponse aax', function () {
1813
+ describe('interpretResponse trustedstack', function () {
1814
1814
  it('should not push response if no-bid', function () {
1815
1815
  let validBids = [];
1816
1816
  let bids = spec.interpretResponse(SERVER_RESPONSE_NOBID, []);
@@ -1,5 +1,6 @@
1
1
  import {expect} from 'chai';
2
2
  import {spec} from 'modules/mediasquareBidAdapter.js';
3
+ import { server } from 'test/mocks/xhr.js';
3
4
 
4
5
  describe('MediaSquare bid adapter tests', function () {
5
6
  var DEFAULT_PARAMS = [{
@@ -208,6 +209,10 @@ describe('MediaSquare bid adapter tests', function () {
208
209
  const response = spec.interpretResponse(BID_RESPONSE, request);
209
210
  const won = spec.onBidWon(response[0]);
210
211
  expect(won).to.equal(true);
212
+ expect(server.requests.length).to.equal(1);
213
+ let message = JSON.parse(server.requests[0].requestBody);
214
+ expect(message).to.have.property('increment').exist;
215
+ expect(message).to.have.property('increment').and.to.equal('1');
211
216
  });
212
217
  it('Verifies user sync without cookie in bid response', function () {
213
218
  var syncs = spec.getUserSyncs({}, [BID_RESPONSE], DEFAULT_OPTIONS.gdprConsent, DEFAULT_OPTIONS.uspConsent);
@@ -1667,6 +1667,12 @@ describe('newspassid Adapter', function () {
1667
1667
  expect(result[0]['price']).to.equal(0.9);
1668
1668
  expect(result[0]['adserverTargeting']['np_npappnexus_adId']).to.equal('2899ec066a91ff8-0-np-1');
1669
1669
  });
1670
+ it('should add np_auc_id (response id value)', function () {
1671
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1672
+ let validres = JSON.parse(JSON.stringify(validBidResponse1adWith2Bidders));
1673
+ const result = spec.interpretResponse(validres, request);
1674
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_auc_id')).to.equal(validBidResponse1adWith2Bidders.body.id);
1675
+ });
1670
1676
  it('should correctly process an auction with 2 adunits & multiple bidders one of which bids for both adslots', function() {
1671
1677
  let validres = JSON.parse(JSON.stringify(multiResponse1));
1672
1678
  let request = spec.buildRequests(multiRequest1, multiBidderRequest1.bidderRequest);
@@ -1,5 +1,5 @@
1
1
  import { expect } from 'chai';
2
- import { spec } from 'modules/optidigitalBidAdapter.js';
2
+ import { spec, resetSync } from 'modules/optidigitalBidAdapter.js';
3
3
  import * as utils from 'src/utils.js';
4
4
 
5
5
  const ENDPOINT = 'https://pbs.optidigital.com/bidder';
@@ -497,6 +497,7 @@ describe('optidigitalAdapterTests', function () {
497
497
  let test;
498
498
  beforeEach(function () {
499
499
  test = sinon.sandbox.create();
500
+ resetSync();
500
501
  });
501
502
  afterEach(function() {
502
503
  test.restore();
@@ -508,16 +509,22 @@ describe('optidigitalAdapterTests', function () {
508
509
  }]);
509
510
  });
510
511
 
511
- it('should return appropriate URL', function() {
512
+ it('should return appropriate URL with GDPR equals to 1 and GDPR consent', function() {
512
513
  expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, undefined)).to.deep.equal([{
513
514
  type: 'iframe', url: `${syncurlIframe}&gdpr=1&gdpr_consent=foo`
514
515
  }]);
516
+ });
517
+ it('should return appropriate URL with GDPR equals to 0 and GDPR consent', function() {
515
518
  expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: false, consentString: 'foo'}, undefined)).to.deep.equal([{
516
519
  type: 'iframe', url: `${syncurlIframe}&gdpr=0&gdpr_consent=foo`
517
520
  }]);
521
+ });
522
+ it('should return appropriate URL with GDPR equals to 1 and no consent', function() {
518
523
  expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: true, consentString: undefined}, undefined)).to.deep.equal([{
519
524
  type: 'iframe', url: `${syncurlIframe}&gdpr=1&gdpr_consent=`
520
525
  }]);
526
+ });
527
+ it('should return appropriate URL with GDPR equals to 1, GDPR consent and CCPA consent', function() {
521
528
  expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, {consentString: 'fooUsp'})).to.deep.equal([{
522
529
  type: 'iframe', url: `${syncurlIframe}&gdpr=1&gdpr_consent=foo&ccpa_consent=fooUsp`
523
530
  }]);
@@ -0,0 +1,399 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from '../../../modules/pubCircleBidAdapter';
3
+ import { BANNER, VIDEO, NATIVE } from '../../../src/mediaTypes.js';
4
+ import { getUniqueIdentifierStr } from '../../../src/utils.js';
5
+
6
+ const bidder = 'pubcircle'
7
+
8
+ describe('PubCircleBidAdapter', 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
+ timeout: 500
81
+ };
82
+
83
+ describe('isBidRequestValid', function () {
84
+ it('Should return true if there are bidId, params and key parameters present', function () {
85
+ expect(spec.isBidRequestValid(bids[0])).to.be.true;
86
+ });
87
+ it('Should return false if at least one of parameters is not present', function () {
88
+ expect(spec.isBidRequestValid(invalidBid)).to.be.false;
89
+ });
90
+ });
91
+
92
+ describe('buildRequests', function () {
93
+ let serverRequest = spec.buildRequests(bids, bidderRequest);
94
+
95
+ it('Creates a ServerRequest object with method, URL and data', function () {
96
+ expect(serverRequest).to.exist;
97
+ expect(serverRequest.method).to.exist;
98
+ expect(serverRequest.url).to.exist;
99
+ expect(serverRequest.data).to.exist;
100
+ });
101
+
102
+ it('Returns POST method', function () {
103
+ expect(serverRequest.method).to.equal('POST');
104
+ });
105
+
106
+ it('Returns valid URL', function () {
107
+ expect(serverRequest.url).to.equal('https://ml.pubcircle.ai/pbjs');
108
+ });
109
+
110
+ it('Returns general data valid', function () {
111
+ let data = serverRequest.data;
112
+ expect(data).to.be.an('object');
113
+ expect(data).to.have.all.keys('deviceWidth',
114
+ 'deviceHeight',
115
+ 'language',
116
+ 'secure',
117
+ 'host',
118
+ 'page',
119
+ 'placements',
120
+ 'coppa',
121
+ 'ccpa',
122
+ 'gdpr',
123
+ 'tmax'
124
+ );
125
+ expect(data.deviceWidth).to.be.a('number');
126
+ expect(data.deviceHeight).to.be.a('number');
127
+ expect(data.language).to.be.a('string');
128
+ expect(data.secure).to.be.within(0, 1);
129
+ expect(data.host).to.be.a('string');
130
+ expect(data.page).to.be.a('string');
131
+ expect(data.coppa).to.be.a('number');
132
+ expect(data.gdpr).to.be.a('string');
133
+ expect(data.ccpa).to.be.a('string');
134
+ expect(data.tmax).to.be.a('number');
135
+ expect(data.placements).to.have.lengthOf(3);
136
+ });
137
+
138
+ it('Returns valid placements', function () {
139
+ const { placements } = serverRequest.data;
140
+ for (let i = 0, len = placements.length; i < len; i++) {
141
+ const placement = placements[i];
142
+ expect(placement.placementId).to.be.oneOf(['testBanner', 'testVideo', 'testNative']);
143
+ expect(placement.adFormat).to.be.oneOf([BANNER, VIDEO, NATIVE]);
144
+ expect(placement.bidId).to.be.a('string');
145
+ expect(placement.schain).to.be.an('object');
146
+ expect(placement.bidfloor).to.exist.and.to.equal(0);
147
+ expect(placement.type).to.exist.and.to.equal('publisher');
148
+
149
+ if (placement.adFormat === BANNER) {
150
+ expect(placement.sizes).to.be.an('array');
151
+ }
152
+ switch (placement.adFormat) {
153
+ case BANNER:
154
+ expect(placement.sizes).to.be.an('array');
155
+ break;
156
+ case VIDEO:
157
+ expect(placement.playerSize).to.be.an('array');
158
+ expect(placement.minduration).to.be.an('number');
159
+ expect(placement.maxduration).to.be.an('number');
160
+ break;
161
+ case NATIVE:
162
+ expect(placement.native).to.be.an('object');
163
+ break;
164
+ }
165
+ }
166
+ });
167
+
168
+ it('Returns data with gdprConsent and without uspConsent', function () {
169
+ delete bidderRequest.uspConsent;
170
+ serverRequest = spec.buildRequests(bids, bidderRequest);
171
+ let data = serverRequest.data;
172
+ expect(data.gdpr).to.exist;
173
+ expect(data.gdpr).to.be.a('string');
174
+ expect(data.gdpr).to.equal(bidderRequest.gdprConsent);
175
+ expect(data.ccpa).to.not.exist;
176
+ delete bidderRequest.gdprConsent;
177
+ });
178
+
179
+ it('Returns data with uspConsent and without gdprConsent', function () {
180
+ bidderRequest.uspConsent = '1---';
181
+ delete bidderRequest.gdprConsent;
182
+ serverRequest = spec.buildRequests(bids, bidderRequest);
183
+ let data = serverRequest.data;
184
+ expect(data.ccpa).to.exist;
185
+ expect(data.ccpa).to.be.a('string');
186
+ expect(data.ccpa).to.equal(bidderRequest.uspConsent);
187
+ expect(data.gdpr).to.not.exist;
188
+ });
189
+
190
+ it('Returns empty data if no valid requests are passed', function () {
191
+ serverRequest = spec.buildRequests([], bidderRequest);
192
+ let data = serverRequest.data;
193
+ expect(data.placements).to.be.an('array').that.is.empty;
194
+ });
195
+ });
196
+
197
+ describe('interpretResponse', function () {
198
+ it('Should interpret banner response', function () {
199
+ const banner = {
200
+ body: [{
201
+ mediaType: 'banner',
202
+ width: 300,
203
+ height: 250,
204
+ cpm: 0.4,
205
+ ad: 'Test',
206
+ requestId: '23fhj33i987f',
207
+ ttl: 120,
208
+ creativeId: '2',
209
+ netRevenue: true,
210
+ currency: 'USD',
211
+ dealId: '1',
212
+ meta: {
213
+ advertiserDomains: ['google.com'],
214
+ advertiserId: 1234
215
+ }
216
+ }]
217
+ };
218
+ let bannerResponses = spec.interpretResponse(banner);
219
+ expect(bannerResponses).to.be.an('array').that.is.not.empty;
220
+ let dataItem = bannerResponses[0];
221
+ expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId',
222
+ 'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
223
+ expect(dataItem.requestId).to.equal(banner.body[0].requestId);
224
+ expect(dataItem.cpm).to.equal(banner.body[0].cpm);
225
+ expect(dataItem.width).to.equal(banner.body[0].width);
226
+ expect(dataItem.height).to.equal(banner.body[0].height);
227
+ expect(dataItem.ad).to.equal(banner.body[0].ad);
228
+ expect(dataItem.ttl).to.equal(banner.body[0].ttl);
229
+ expect(dataItem.creativeId).to.equal(banner.body[0].creativeId);
230
+ expect(dataItem.netRevenue).to.be.true;
231
+ expect(dataItem.currency).to.equal(banner.body[0].currency);
232
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
233
+ });
234
+ it('Should interpret video response', function () {
235
+ const video = {
236
+ body: [{
237
+ vastUrl: 'test.com',
238
+ mediaType: 'video',
239
+ cpm: 0.5,
240
+ requestId: '23fhj33i987f',
241
+ ttl: 120,
242
+ creativeId: '2',
243
+ netRevenue: true,
244
+ currency: 'USD',
245
+ dealId: '1',
246
+ meta: {
247
+ advertiserDomains: ['google.com'],
248
+ advertiserId: 1234
249
+ }
250
+ }]
251
+ };
252
+ let videoResponses = spec.interpretResponse(video);
253
+ expect(videoResponses).to.be.an('array').that.is.not.empty;
254
+
255
+ let dataItem = videoResponses[0];
256
+ expect(dataItem).to.have.all.keys('requestId', 'cpm', 'vastUrl', 'ttl', 'creativeId',
257
+ 'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
258
+ expect(dataItem.requestId).to.equal('23fhj33i987f');
259
+ expect(dataItem.cpm).to.equal(0.5);
260
+ expect(dataItem.vastUrl).to.equal('test.com');
261
+ expect(dataItem.ttl).to.equal(120);
262
+ expect(dataItem.creativeId).to.equal('2');
263
+ expect(dataItem.netRevenue).to.be.true;
264
+ expect(dataItem.currency).to.equal('USD');
265
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
266
+ });
267
+ it('Should interpret native response', function () {
268
+ const native = {
269
+ body: [{
270
+ mediaType: 'native',
271
+ native: {
272
+ clickUrl: 'test.com',
273
+ title: 'Test',
274
+ image: 'test.com',
275
+ impressionTrackers: ['test.com'],
276
+ },
277
+ ttl: 120,
278
+ cpm: 0.4,
279
+ requestId: '23fhj33i987f',
280
+ creativeId: '2',
281
+ netRevenue: true,
282
+ currency: 'USD',
283
+ meta: {
284
+ advertiserDomains: ['google.com'],
285
+ advertiserId: 1234
286
+ }
287
+ }]
288
+ };
289
+ let nativeResponses = spec.interpretResponse(native);
290
+ expect(nativeResponses).to.be.an('array').that.is.not.empty;
291
+
292
+ let dataItem = nativeResponses[0];
293
+ expect(dataItem).to.have.keys('requestId', 'cpm', 'ttl', 'creativeId', 'netRevenue', 'currency', 'mediaType', 'native', 'meta');
294
+ expect(dataItem.native).to.have.keys('clickUrl', 'impressionTrackers', 'title', 'image')
295
+ expect(dataItem.requestId).to.equal('23fhj33i987f');
296
+ expect(dataItem.cpm).to.equal(0.4);
297
+ expect(dataItem.native.clickUrl).to.equal('test.com');
298
+ expect(dataItem.native.title).to.equal('Test');
299
+ expect(dataItem.native.image).to.equal('test.com');
300
+ expect(dataItem.native.impressionTrackers).to.be.an('array').that.is.not.empty;
301
+ expect(dataItem.native.impressionTrackers[0]).to.equal('test.com');
302
+ expect(dataItem.ttl).to.equal(120);
303
+ expect(dataItem.creativeId).to.equal('2');
304
+ expect(dataItem.netRevenue).to.be.true;
305
+ expect(dataItem.currency).to.equal('USD');
306
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
307
+ });
308
+ it('Should return an empty array if invalid banner response is passed', function () {
309
+ const invBanner = {
310
+ body: [{
311
+ width: 300,
312
+ cpm: 0.4,
313
+ ad: 'Test',
314
+ requestId: '23fhj33i987f',
315
+ ttl: 120,
316
+ creativeId: '2',
317
+ netRevenue: true,
318
+ currency: 'USD',
319
+ dealId: '1'
320
+ }]
321
+ };
322
+
323
+ let serverResponses = spec.interpretResponse(invBanner);
324
+ expect(serverResponses).to.be.an('array').that.is.empty;
325
+ });
326
+ it('Should return an empty array if invalid video response is passed', function () {
327
+ const invVideo = {
328
+ body: [{
329
+ mediaType: 'video',
330
+ cpm: 0.5,
331
+ requestId: '23fhj33i987f',
332
+ ttl: 120,
333
+ creativeId: '2',
334
+ netRevenue: true,
335
+ currency: 'USD',
336
+ dealId: '1'
337
+ }]
338
+ };
339
+ let serverResponses = spec.interpretResponse(invVideo);
340
+ expect(serverResponses).to.be.an('array').that.is.empty;
341
+ });
342
+ it('Should return an empty array if invalid native response is passed', function () {
343
+ const invNative = {
344
+ body: [{
345
+ mediaType: 'native',
346
+ clickUrl: 'test.com',
347
+ title: 'Test',
348
+ impressionTrackers: ['test.com'],
349
+ ttl: 120,
350
+ requestId: '23fhj33i987f',
351
+ creativeId: '2',
352
+ netRevenue: true,
353
+ currency: 'USD',
354
+ }]
355
+ };
356
+ let serverResponses = spec.interpretResponse(invNative);
357
+ expect(serverResponses).to.be.an('array').that.is.empty;
358
+ });
359
+ it('Should return an empty array if invalid response is passed', function () {
360
+ const invalid = {
361
+ body: [{
362
+ ttl: 120,
363
+ creativeId: '2',
364
+ netRevenue: true,
365
+ currency: 'USD',
366
+ dealId: '1'
367
+ }]
368
+ };
369
+ let serverResponses = spec.interpretResponse(invalid);
370
+ expect(serverResponses).to.be.an('array').that.is.empty;
371
+ });
372
+ });
373
+
374
+ describe('getUserSyncs', function() {
375
+ it('Should return array of objects with proper sync config , include GDPR', function() {
376
+ const syncData = spec.getUserSyncs({}, {}, {
377
+ consentString: 'ALL',
378
+ gdprApplies: true,
379
+ }, {});
380
+ expect(syncData).to.be.an('array').which.is.not.empty;
381
+ expect(syncData[0]).to.be.an('object')
382
+ expect(syncData[0].type).to.be.a('string')
383
+ expect(syncData[0].type).to.equal('image')
384
+ expect(syncData[0].url).to.be.a('string')
385
+ expect(syncData[0].url).to.equal('https://cs.pubcircle.ai/image?pbjs=1&gdpr=1&gdpr_consent=ALL&coppa=0')
386
+ });
387
+ it('Should return array of objects with proper sync config , include CCPA', function() {
388
+ const syncData = spec.getUserSyncs({}, {}, {}, {
389
+ consentString: '1---'
390
+ });
391
+ expect(syncData).to.be.an('array').which.is.not.empty;
392
+ expect(syncData[0]).to.be.an('object')
393
+ expect(syncData[0].type).to.be.a('string')
394
+ expect(syncData[0].type).to.equal('image')
395
+ expect(syncData[0].url).to.be.a('string')
396
+ expect(syncData[0].url).to.equal('https://cs.pubcircle.ai/image?pbjs=1&ccpa_consent=1---&coppa=0')
397
+ });
398
+ });
399
+ });
@@ -466,4 +466,23 @@ describe('Tappx bid adapter', function () {
466
466
  assert.isString(_extractPageUrl(validBidRequests, bidderRequest));
467
467
  });
468
468
  })
469
+
470
+ describe('Empty params values from bid tests', function() {
471
+ let validBidRequest = JSON.parse(JSON.stringify(c_BIDREQUEST));
472
+
473
+ it('should return false when tappxkey is empty', function () {
474
+ validBidRequest.bids[0].params.tappxkey = '';
475
+ assert.isFalse(spec.isBidRequestValid(validBidRequest.bids[0]));
476
+ });
477
+
478
+ it('should return false when host is empty', function () {
479
+ validBidRequest.bids[0].params.host = '';
480
+ assert.isFalse(spec.isBidRequestValid(validBidRequest.bids[0]));
481
+ });
482
+
483
+ it('should return false when endpoint is empty', function () {
484
+ validBidRequest.bids[0].params.endpoint = '';
485
+ assert.isFalse(spec.isBidRequestValid(validBidRequest.bids[0]));
486
+ });
487
+ });
469
488
  });