prebid.js 6.28.0 → 6.29.2

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 (162) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/adagioBidAdapter.js +1 -1
  3. package/dist/adbookpspBidAdapter.js +1 -1
  4. package/dist/adgenerationBidAdapter.js +1 -1
  5. package/dist/adoceanBidAdapter.js +1 -1
  6. package/dist/adrelevantisBidAdapter.js +1 -1
  7. package/dist/adxcgBidAdapter.js +1 -1
  8. package/dist/adyoulikeBidAdapter.js +1 -1
  9. package/dist/ajaBidAdapter.js +1 -1
  10. package/dist/amxBidAdapter.js +1 -1
  11. package/dist/amxIdSystem.js +1 -1
  12. package/dist/appierAnalyticsAdapter.js +1 -1
  13. package/dist/appnexusBidAdapter.js +1 -1
  14. package/dist/asoBidAdapter.js +1 -1
  15. package/dist/audiencerunBidAdapter.js +1 -1
  16. package/dist/axonixBidAdapter.js +1 -1
  17. package/dist/bidglassBidAdapter.js +1 -1
  18. package/dist/big-richmediaBidAdapter.js +1 -1
  19. package/dist/bluebillywigBidAdapter.js +1 -1
  20. package/dist/bridgewellBidAdapter.js +1 -1
  21. package/dist/brightMountainMediaBidAdapter.js +1 -1
  22. package/dist/concertBidAdapter.js +1 -1
  23. package/dist/connectIdSystem.js +1 -1
  24. package/dist/connectadBidAdapter.js +1 -1
  25. package/dist/consentManagement.js +1 -1
  26. package/dist/consumableBidAdapter.js +1 -1
  27. package/dist/conversantBidAdapter.js +1 -1
  28. package/dist/craftBidAdapter.js +1 -1
  29. package/dist/criteoBidAdapter.js +1 -1
  30. package/dist/currency.js +1 -1
  31. package/dist/dspxBidAdapter.js +1 -1
  32. package/dist/eplanningBidAdapter.js +1 -1
  33. package/dist/gdprEnforcement.js +1 -1
  34. package/dist/glimpseBidAdapter.js +1 -1
  35. package/dist/gmosspBidAdapter.js +1 -1
  36. package/dist/goldbachBidAdapter.js +1 -1
  37. package/dist/gridBidAdapter.js +1 -1
  38. package/dist/gridNMBidAdapter.js +1 -1
  39. package/dist/gumgumBidAdapter.js +1 -1
  40. package/dist/h12mediaBidAdapter.js +1 -1
  41. package/dist/id5IdSystem.js +1 -1
  42. package/dist/impactifyBidAdapter.js +1 -1
  43. package/dist/improvedigitalBidAdapter.js +1 -1
  44. package/dist/inmarBidAdapter.js +1 -1
  45. package/dist/insticatorBidAdapter.js +1 -1
  46. package/dist/ixBidAdapter.js +1 -1
  47. package/dist/jixieBidAdapter.js +1 -1
  48. package/dist/justpremiumBidAdapter.js +1 -1
  49. package/dist/konduitAnalyticsAdapter.js +1 -1
  50. package/dist/lassoBidAdapter.js +1 -0
  51. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  52. package/dist/logicadBidAdapter.js +1 -1
  53. package/dist/loglyliftBidAdapter.js +1 -1
  54. package/dist/malltvAnalyticsAdapter.js +1 -1
  55. package/dist/marsmediaBidAdapter.js +1 -1
  56. package/dist/mediafuseBidAdapter.js +1 -1
  57. package/dist/mediakeysBidAdapter.js +1 -1
  58. package/dist/mediasquareBidAdapter.js +1 -1
  59. package/dist/merkleIdSystem.js +1 -1
  60. package/dist/mgidBidAdapter.js +1 -1
  61. package/dist/minutemediaBidAdapter.js +1 -1
  62. package/dist/not-for-prod/prebid.js +120 -119
  63. package/dist/oguryBidAdapter.js +1 -1
  64. package/dist/oneVideoBidAdapter.js +1 -1
  65. package/dist/onetagBidAdapter.js +1 -1
  66. package/dist/ooloAnalyticsAdapter.js +1 -1
  67. package/dist/outbrainBidAdapter.js +1 -1
  68. package/dist/parrableIdSystem.js +1 -1
  69. package/dist/pixfutureBidAdapter.js +1 -1
  70. package/dist/prebid-core.js +3 -3
  71. package/dist/pubCommonId.js +1 -1
  72. package/dist/publinkIdSystem.js +1 -1
  73. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  74. package/dist/pubmaticBidAdapter.js +1 -1
  75. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  76. package/dist/pxyzBidAdapter.js +1 -1
  77. package/dist/quantcastBidAdapter.js +1 -1
  78. package/dist/readpeakBidAdapter.js +1 -1
  79. package/dist/relaidoBidAdapter.js +1 -1
  80. package/dist/rhythmoneBidAdapter.js +1 -1
  81. package/dist/riseBidAdapter.js +1 -1
  82. package/dist/rubiconAnalyticsAdapter.js +1 -1
  83. package/dist/rubiconBidAdapter.js +1 -1
  84. package/dist/seedingAllianceBidAdapter.js +1 -1
  85. package/dist/seedtagBidAdapter.js +1 -1
  86. package/dist/sharedIdSystem.js +1 -1
  87. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  88. package/dist/sharethroughBidAdapter.js +1 -1
  89. package/dist/smaatoBidAdapter.js +1 -1
  90. package/dist/smartadserverBidAdapter.js +1 -1
  91. package/dist/smartxBidAdapter.js +1 -1
  92. package/dist/smilewantedBidAdapter.js +1 -1
  93. package/dist/sonobiBidAdapter.js +1 -1
  94. package/dist/sortableBidAdapter.js +1 -1
  95. package/dist/sovrnAnalyticsAdapter.js +1 -1
  96. package/dist/sovrnBidAdapter.js +1 -1
  97. package/dist/sspBCBidAdapter.js +1 -1
  98. package/dist/sublimeBidAdapter.js +1 -1
  99. package/dist/synacormediaBidAdapter.js +1 -1
  100. package/dist/taboolaBidAdapter.js +1 -1
  101. package/dist/targetVideoBidAdapter.js +1 -1
  102. package/dist/teadsBidAdapter.js +1 -1
  103. package/dist/trionBidAdapter.js +1 -1
  104. package/dist/tripleliftBidAdapter.js +1 -1
  105. package/dist/trustxBidAdapter.js +1 -1
  106. package/dist/ttdBidAdapter.js +1 -1
  107. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  108. package/dist/underdogmediaBidAdapter.js +1 -1
  109. package/dist/undertoneBidAdapter.js +1 -1
  110. package/dist/userId.js +1 -1
  111. package/dist/vidazooBidAdapter.js +1 -1
  112. package/dist/videobyteBidAdapter.js +1 -1
  113. package/dist/visxBidAdapter.js +1 -1
  114. package/dist/vuukleBidAdapter.js +1 -1
  115. package/dist/widespaceBidAdapter.js +1 -1
  116. package/dist/winrBidAdapter.js +1 -1
  117. package/dist/yahoosspBidAdapter.js +1 -1
  118. package/dist/yieldmoBidAdapter.js +1 -1
  119. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  120. package/modules/adoceanBidAdapter.js +29 -1
  121. package/modules/consentManagement.js +20 -10
  122. package/modules/currency.js +2 -2
  123. package/modules/gdprEnforcement.js +15 -9
  124. package/modules/insticatorBidAdapter.js +109 -42
  125. package/modules/ixBidAdapter.js +3 -2
  126. package/modules/ixBidAdapter.md +1 -1
  127. package/modules/lassoBidAdapter.js +133 -0
  128. package/modules/lassoBidAdapter.md +29 -0
  129. package/modules/merkleIdSystem.js +43 -31
  130. package/modules/pubCommonId.js +2 -1
  131. package/modules/pubmaticAnalyticsAdapter.js +49 -33
  132. package/modules/sharedIdSystem.js +5 -11
  133. package/modules/synacormediaBidAdapter.js +11 -2
  134. package/modules/taboolaBidAdapter.js +1 -1
  135. package/modules/userId/eids.js +25 -5
  136. package/modules/userId/index.js +39 -21
  137. package/package.json +1 -1
  138. package/src/auction.js +6 -5
  139. package/src/consentHandler.js +11 -11
  140. package/src/hook.js +2 -2
  141. package/src/storageManager.js +5 -4
  142. package/src/utils/promise.js +96 -21
  143. package/src/utils.js +3 -2
  144. package/test/helpers/consentData.js +2 -1
  145. package/test/spec/auctionmanager_spec.js +1 -6
  146. package/test/spec/modules/adoceanBidAdapter_spec.js +25 -1
  147. package/test/spec/modules/consentManagement_spec.js +75 -16
  148. package/test/spec/modules/eids_spec.js +48 -3
  149. package/test/spec/modules/gdprEnforcement_spec.js +100 -53
  150. package/test/spec/modules/idxIdSystem_spec.js +1 -1
  151. package/test/spec/modules/insticatorBidAdapter_spec.js +46 -1
  152. package/test/spec/modules/ixBidAdapter_spec.js +1 -1
  153. package/test/spec/modules/lassoBidAdapter_spec.js +177 -0
  154. package/test/spec/modules/merkleIdSystem_spec.js +58 -37
  155. package/test/spec/modules/parrableIdSystem_spec.js +2 -1
  156. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +117 -0
  157. package/test/spec/modules/synacormediaBidAdapter_spec.js +74 -0
  158. package/test/spec/modules/userId_spec.js +42 -3
  159. package/test/spec/modules/vidazooBidAdapter_spec.js +9 -4
  160. package/test/spec/unit/pbjs_api_spec.js +2 -6
  161. package/test/spec/unit/utils/promise_spec.js +283 -38
  162. package/test/helpers/syncPromise.js +0 -71
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  deviceAccessHook,
3
- setEnforcementConfig,
4
- userSyncHook,
5
- userIdHook,
6
- makeBidRequestsHook,
7
- validateRules,
3
+ enableAnalyticsHook,
8
4
  enforcementRules,
5
+ getGvlid,
6
+ internal,
7
+ makeBidRequestsHook,
9
8
  purpose1Rule,
10
9
  purpose2Rule,
11
- enableAnalyticsHook,
12
- getGvlid,
13
- internal
10
+ setEnforcementConfig,
11
+ userIdHook,
12
+ userSyncHook,
13
+ validateRules
14
14
  } from 'modules/gdprEnforcement.js';
15
- import { config } from 'src/config.js';
16
- import adapterManager, { gdprDataHandler } from 'src/adapterManager.js';
15
+ import {config} from 'src/config.js';
16
+ import adapterManager, {gdprDataHandler} from 'src/adapterManager.js';
17
17
  import * as utils from 'src/utils.js';
18
- import { validateStorageEnforcement } from 'src/storageManager.js';
18
+ import {validateStorageEnforcement} from 'src/storageManager.js';
19
19
  import * as events from 'src/events.js';
20
20
 
21
21
  describe('gdpr enforcement', function () {
@@ -98,9 +98,9 @@ describe('gdpr enforcement', function () {
98
98
  };
99
99
 
100
100
  after(function () {
101
- validateStorageEnforcement.getHooks({ hook: deviceAccessHook }).remove();
101
+ validateStorageEnforcement.getHooks({hook: deviceAccessHook}).remove();
102
102
  $$PREBID_GLOBAL$$.requestBids.getHooks().remove();
103
- adapterManager.makeBidRequests.getHooks({ hook: makeBidRequestsHook }).remove();
103
+ adapterManager.makeBidRequests.getHooks({hook: makeBidRequestsHook}).remove();
104
104
  })
105
105
 
106
106
  describe('deviceAccessHook', function () {
@@ -149,7 +149,7 @@ describe('gdpr enforcement', function () {
149
149
  hasEnforcementHook: true,
150
150
  valid: false
151
151
  }
152
- sinon.assert.calledWith(nextFnSpy, undefined, undefined, result);
152
+ sinon.assert.calledWith(nextFnSpy, undefined, undefined, undefined, result);
153
153
  });
154
154
 
155
155
  it('should only check for consent for vendor exceptions when enforcePurpose and enforceVendor are false', function () {
@@ -199,6 +199,53 @@ describe('gdpr enforcement', function () {
199
199
  expect(logWarnSpy.callCount).to.equal(1);
200
200
  });
201
201
 
202
+ it('should allow device access when enforce vendor but module is vendorless ', function () {
203
+ adapterManagerStub.withArgs('pubCommonId').returns(getBidderSpec(1));
204
+ setEnforcementConfig({
205
+ gdpr: {
206
+ rules: [{
207
+ purpose: 'storage',
208
+ enforcePurpose: true,
209
+ enforceVendor: true,
210
+ }]
211
+ }
212
+ });
213
+ let consentData = {}
214
+ consentData.vendorData = staticConfig.consentData.getTCData;
215
+ consentData.gdprApplies = true;
216
+ consentData.apiVersion = 2;
217
+ gdprDataHandlerStub.returns(consentData);
218
+
219
+ deviceAccessHook(nextFnSpy, 1, 'pubCommonId', 'fpid-module');
220
+ expect(logWarnSpy.callCount).to.equal(0);
221
+ });
222
+
223
+ it('should not allow device access if enforce vendor, module is vendorless, but there is no consent for purpose 1', function () {
224
+ adapterManagerStub.withArgs('pubCommonId').returns(getBidderSpec(1));
225
+ setEnforcementConfig({
226
+ gdpr: {
227
+ rules: [{
228
+ purpose: 'storage',
229
+ enforcePurpose: true,
230
+ enforceVendor: true,
231
+ }]
232
+ }
233
+ });
234
+
235
+ let consentData = {}
236
+ // set consent for purpose 1 to false
237
+ const newConsentData = utils.deepClone(staticConfig);
238
+ newConsentData.consentData.getTCData.purpose.consents['1'] = false;
239
+ consentData.vendorData = newConsentData.consentData.getTCData;
240
+ consentData.apiVersion = 2;
241
+ consentData.gdprApplies = true;
242
+
243
+ gdprDataHandlerStub.returns(consentData);
244
+
245
+ deviceAccessHook(nextFnSpy, 1, 'pubCommonId', 'fpid-module');
246
+ expect(logWarnSpy.callCount).to.equal(1);
247
+ });
248
+
202
249
  it('should allow device access when gdprApplies is false and hasDeviceAccess flag is true', function () {
203
250
  adapterManagerStub.withArgs('appnexus').returns(getBidderSpec(1));
204
251
  setEnforcementConfig({
@@ -223,10 +270,10 @@ describe('gdpr enforcement', function () {
223
270
  hasEnforcementHook: true,
224
271
  valid: true
225
272
  }
226
- sinon.assert.calledWith(nextFnSpy, 1, 'appnexus', result);
273
+ sinon.assert.calledWith(nextFnSpy, 1, 'appnexus', undefined, result);
227
274
  });
228
275
 
229
- it('should use gvlMapping set by publisher', function() {
276
+ it('should use gvlMapping set by publisher', function () {
230
277
  config.setConfig({
231
278
  'gvlMapping': {
232
279
  'appnexus': 4
@@ -254,11 +301,11 @@ describe('gdpr enforcement', function () {
254
301
  hasEnforcementHook: true,
255
302
  valid: true
256
303
  }
257
- sinon.assert.calledWith(nextFnSpy, 4, 'appnexus', result);
304
+ sinon.assert.calledWith(nextFnSpy, 4, 'appnexus', undefined, result);
258
305
  config.resetConfig();
259
306
  });
260
307
 
261
- it('should use gvl id of alias and not of parent', function() {
308
+ it('should use gvl id of alias and not of parent', function () {
262
309
  let curBidderStub = sinon.stub(config, 'getCurrentBidder');
263
310
  curBidderStub.returns('appnexus-alias');
264
311
  adapterManager.aliasBidAdapter('appnexus', 'appnexus-alias');
@@ -289,7 +336,7 @@ describe('gdpr enforcement', function () {
289
336
  hasEnforcementHook: true,
290
337
  valid: true
291
338
  }
292
- sinon.assert.calledWith(nextFnSpy, 4, 'appnexus', result);
339
+ sinon.assert.calledWith(nextFnSpy, 4, 'appnexus', undefined, result);
293
340
  config.resetConfig();
294
341
  curBidderStub.restore();
295
342
  });
@@ -470,7 +517,7 @@ describe('gdpr enforcement', function () {
470
517
  const args = nextFnSpy.getCalls()[0].args;
471
518
  expect(args[1].hasValidated).to.be.true;
472
519
  expect(nextFnSpy.calledOnce).to.equal(true);
473
- sinon.assert.calledWith(nextFnSpy, submodules, { ...consentData, hasValidated: true });
520
+ sinon.assert.calledWith(nextFnSpy, submodules, {...consentData, hasValidated: true});
474
521
  });
475
522
 
476
523
  it('should allow userId module if gdpr not in scope', function () {
@@ -524,7 +571,7 @@ describe('gdpr enforcement', function () {
524
571
  name: 'sampleUserId'
525
572
  }
526
573
  }]
527
- sinon.assert.calledWith(nextFnSpy, expectedSubmodules, { ...consentData, hasValidated: true });
574
+ sinon.assert.calledWith(nextFnSpy, expectedSubmodules, {...consentData, hasValidated: true});
528
575
  });
529
576
  });
530
577
 
@@ -583,17 +630,17 @@ describe('gdpr enforcement', function () {
583
630
  gdprDataHandlerStub.returns(consentData);
584
631
  adapterManagerStub.withArgs('bidder_1').returns({
585
632
  getSpec: function () {
586
- return { 'gvlid': 4 }
633
+ return {'gvlid': 4}
587
634
  }
588
635
  });
589
636
  adapterManagerStub.withArgs('bidder_2').returns({
590
637
  getSpec: function () {
591
- return { 'gvlid': 5 }
638
+ return {'gvlid': 5}
592
639
  }
593
640
  });
594
641
  adapterManagerStub.withArgs('bidder_3').returns({
595
642
  getSpec: function () {
596
- return { 'gvlid': undefined }
643
+ return {'gvlid': undefined}
597
644
  }
598
645
  });
599
646
  makeBidRequestsHook(nextFnSpy, MOCK_AD_UNITS, []);
@@ -604,20 +651,20 @@ describe('gdpr enforcement', function () {
604
651
  code: 'ad-unit-1',
605
652
  mediaTypes: {},
606
653
  bids: [
607
- sinon.match({ bidder: 'bidder_1' }),
608
- sinon.match({ bidder: 'bidder_2' })
654
+ sinon.match({bidder: 'bidder_1'}),
655
+ sinon.match({bidder: 'bidder_2'})
609
656
  ]
610
657
  }, {
611
658
  code: 'ad-unit-2',
612
659
  mediaTypes: {},
613
660
  bids: [
614
- sinon.match({ bidder: 'bidder_2' }),
615
- sinon.match({ bidder: 'bidder_3' }) // should be allowed even though it's doesn't have a gvlId because liTransparency is established.
661
+ sinon.match({bidder: 'bidder_2'}),
662
+ sinon.match({bidder: 'bidder_3'}) // should be allowed even though it's doesn't have a gvlId because liTransparency is established.
616
663
  ]
617
664
  }], []);
618
665
  });
619
666
 
620
- it('should block bidder which does not have consent and allow bidder which has consent (liTransparency is NOT established)', function() {
667
+ it('should block bidder which does not have consent and allow bidder which has consent (liTransparency is NOT established)', function () {
621
668
  setEnforcementConfig({
622
669
  gdpr: {
623
670
  rules: [{
@@ -641,17 +688,17 @@ describe('gdpr enforcement', function () {
641
688
  gdprDataHandlerStub.returns(consentData);
642
689
  adapterManagerStub.withArgs('bidder_1').returns({
643
690
  getSpec: function () {
644
- return { 'gvlid': 4 }
691
+ return {'gvlid': 4}
645
692
  }
646
693
  });
647
694
  adapterManagerStub.withArgs('bidder_2').returns({
648
695
  getSpec: function () {
649
- return { 'gvlid': 5 }
696
+ return {'gvlid': 5}
650
697
  }
651
698
  });
652
699
  adapterManagerStub.withArgs('bidder_3').returns({
653
700
  getSpec: function () {
654
- return { 'gvlid': undefined }
701
+ return {'gvlid': undefined}
655
702
  }
656
703
  });
657
704
 
@@ -663,13 +710,13 @@ describe('gdpr enforcement', function () {
663
710
  code: 'ad-unit-1',
664
711
  mediaTypes: {},
665
712
  bids: [
666
- sinon.match({ bidder: 'bidder_1' }), // 'bidder_2' is not present because it doesn't have vendorConsent
713
+ sinon.match({bidder: 'bidder_1'}), // 'bidder_2' is not present because it doesn't have vendorConsent
667
714
  ]
668
715
  }, {
669
716
  code: 'ad-unit-2',
670
717
  mediaTypes: {},
671
718
  bids: [
672
- sinon.match({ bidder: 'bidder_3' }), // 'bidder_3' is allowed despite gvlId being undefined because it's part of vendorExceptions
719
+ sinon.match({bidder: 'bidder_3'}), // 'bidder_3' is allowed despite gvlId being undefined because it's part of vendorExceptions
673
720
  ]
674
721
  }], []);
675
722
 
@@ -727,12 +774,12 @@ describe('gdpr enforcement', function () {
727
774
  nextFnSpy = sandbox.spy();
728
775
  });
729
776
 
730
- afterEach(function() {
777
+ afterEach(function () {
731
778
  config.resetConfig();
732
779
  sandbox.restore();
733
780
  });
734
781
 
735
- it('should block analytics adapter which does not have consent and allow the one(s) which have consent', function() {
782
+ it('should block analytics adapter which does not have consent and allow the one(s) which have consent', function () {
736
783
  setEnforcementConfig({
737
784
  gdpr: {
738
785
  rules: [{
@@ -750,9 +797,9 @@ describe('gdpr enforcement', function () {
750
797
  consentData.gdprApplies = true;
751
798
 
752
799
  gdprDataHandlerStub.returns(consentData);
753
- adapterManagerStub.withArgs('analyticsAdapter_A').returns({ gvlid: 3 });
754
- adapterManagerStub.withArgs('analyticsAdapter_B').returns({ gvlid: 5 });
755
- adapterManagerStub.withArgs('analyticsAdapter_C').returns({ gvlid: 1 });
800
+ adapterManagerStub.withArgs('analyticsAdapter_A').returns({gvlid: 3});
801
+ adapterManagerStub.withArgs('analyticsAdapter_B').returns({gvlid: 5});
802
+ adapterManagerStub.withArgs('analyticsAdapter_C').returns({gvlid: 1});
756
803
 
757
804
  enableAnalyticsHook(nextFnSpy, MOCK_ANALYTICS_ADAPTER_CONFIG);
758
805
 
@@ -1025,7 +1072,7 @@ describe('gdpr enforcement', function () {
1025
1072
  expect(purpose2Rule).to.deep.equal(purpose2RuleDefinedInConfig);
1026
1073
  });
1027
1074
 
1028
- it('should use the "rules" defined in config if a definition found', function() {
1075
+ it('should use the "rules" defined in config if a definition found', function () {
1029
1076
  const rules = [{
1030
1077
  purpose: 'storage',
1031
1078
  enforcePurpose: false,
@@ -1035,23 +1082,23 @@ describe('gdpr enforcement', function () {
1035
1082
  enforcePurpose: false,
1036
1083
  enforceVendor: false
1037
1084
  }]
1038
- setEnforcementConfig({gdpr: { rules }});
1085
+ setEnforcementConfig({gdpr: {rules}});
1039
1086
 
1040
1087
  expect(enforcementRules).to.deep.equal(rules);
1041
1088
  });
1042
1089
  });
1043
1090
 
1044
- describe('TCF2FinalResults', function() {
1091
+ describe('TCF2FinalResults', function () {
1045
1092
  let sandbox;
1046
- beforeEach(function() {
1093
+ beforeEach(function () {
1047
1094
  sandbox = sinon.createSandbox();
1048
1095
  sandbox.spy(events, 'emit');
1049
1096
  });
1050
- afterEach(function() {
1097
+ afterEach(function () {
1051
1098
  config.resetConfig();
1052
1099
  sandbox.restore();
1053
1100
  });
1054
- it('should emit TCF2 enforcement data on auction end', function() {
1101
+ it('should emit TCF2 enforcement data on auction end', function () {
1055
1102
  const rules = [{
1056
1103
  purpose: 'storage',
1057
1104
  enforcePurpose: false,
@@ -1061,7 +1108,7 @@ describe('gdpr enforcement', function () {
1061
1108
  enforcePurpose: false,
1062
1109
  enforceVendor: false
1063
1110
  }]
1064
- setEnforcementConfig({gdpr: { rules }});
1111
+ setEnforcementConfig({gdpr: {rules}});
1065
1112
 
1066
1113
  events.emit('auctionEnd', {})
1067
1114
 
@@ -1070,28 +1117,28 @@ describe('gdpr enforcement', function () {
1070
1117
  })
1071
1118
  });
1072
1119
 
1073
- describe('getGvlid', function() {
1120
+ describe('getGvlid', function () {
1074
1121
  let sandbox;
1075
1122
  let getGvlidForBidAdapterStub;
1076
1123
  let getGvlidForUserIdModuleStub;
1077
1124
  let getGvlidForAnalyticsAdapterStub;
1078
- beforeEach(function() {
1125
+ beforeEach(function () {
1079
1126
  sandbox = sinon.createSandbox();
1080
1127
  getGvlidForBidAdapterStub = sandbox.stub(internal, 'getGvlidForBidAdapter');
1081
1128
  getGvlidForUserIdModuleStub = sandbox.stub(internal, 'getGvlidForUserIdModule');
1082
1129
  getGvlidForAnalyticsAdapterStub = sandbox.stub(internal, 'getGvlidForAnalyticsAdapter');
1083
1130
  });
1084
- afterEach(function() {
1131
+ afterEach(function () {
1085
1132
  sandbox.restore();
1086
1133
  config.resetConfig();
1087
1134
  });
1088
1135
 
1089
- it('should return "null" if called without passing any argument', function() {
1136
+ it('should return "null" if called without passing any argument', function () {
1090
1137
  const gvlid = getGvlid();
1091
1138
  expect(gvlid).to.equal(null);
1092
1139
  });
1093
1140
 
1094
- it('should return "null" if GVL ID is not defined for any of these modules: Bid adapter, UserId submodule and Analytics adapter', function() {
1141
+ it('should return "null" if GVL ID is not defined for any of these modules: Bid adapter, UserId submodule and Analytics adapter', function () {
1095
1142
  getGvlidForBidAdapterStub.withArgs('moduleA').returns(null);
1096
1143
  getGvlidForUserIdModuleStub.withArgs('moduleA').returns(null);
1097
1144
  getGvlidForAnalyticsAdapterStub.withArgs('moduleA').returns(null);
@@ -1100,7 +1147,7 @@ describe('gdpr enforcement', function () {
1100
1147
  expect(gvlid).to.equal(null);
1101
1148
  });
1102
1149
 
1103
- it('should return the GVL ID from gvlMapping if it is defined in setConfig', function() {
1150
+ it('should return the GVL ID from gvlMapping if it is defined in setConfig', function () {
1104
1151
  config.setConfig({
1105
1152
  gvlMapping: {
1106
1153
  moduleA: 1
@@ -1114,7 +1161,7 @@ describe('gdpr enforcement', function () {
1114
1161
  expect(gvlid).to.equal(1);
1115
1162
  });
1116
1163
 
1117
- it('should return the GVL ID by calling getGvlidForBidAdapter -> getGvlidForUserIdModule -> getGvlidForAnalyticsAdapter in sequence', function() {
1164
+ it('should return the GVL ID by calling getGvlidForBidAdapter -> getGvlidForUserIdModule -> getGvlidForAnalyticsAdapter in sequence', function () {
1118
1165
  getGvlidForBidAdapterStub.withArgs('moduleA').returns(null);
1119
1166
  getGvlidForUserIdModuleStub.withArgs('moduleA').returns(null);
1120
1167
  getGvlidForAnalyticsAdapterStub.withArgs('moduleA').returns(7);
@@ -94,8 +94,8 @@ describe('IDx ID System', () => {
94
94
  adUnits = [getAdUnitMock()];
95
95
  init(config);
96
96
  setSubmoduleRegistry([idxIdSubmodule]);
97
- config.setConfig(getConfigMock());
98
97
  getCookieStub.withArgs(IDX_COOKIE_NAME).returns(IDX_COOKIE_STORED);
98
+ config.setConfig(getConfigMock());
99
99
  });
100
100
 
101
101
  afterEach(() => {
@@ -27,7 +27,15 @@ describe('InsticatorBidAdapter', function () {
27
27
  banner: {
28
28
  sizes: [[300, 250], [300, 600]],
29
29
  pos: 4,
30
- }
30
+ },
31
+ video: {
32
+ mimes: [
33
+ 'video/mp4',
34
+ 'video/mpeg',
35
+ ],
36
+ w: 250,
37
+ h: 300,
38
+ },
31
39
  },
32
40
  bidId: '30b31c1838de1e',
33
41
  ortb2Imp: {
@@ -116,6 +124,35 @@ describe('InsticatorBidAdapter', function () {
116
124
  bidRequest.mediaTypes.banner.sizes = [[300, 250], [300, 600]];
117
125
  expect(spec.isBidRequestValid({ ...bidRequest, ...{ sizes: {} } })).to.be.true;
118
126
  });
127
+
128
+ it('should return true if there is video and video sizes', () => {
129
+ expect(spec.isBidRequestValid({
130
+ ...bidRequest,
131
+ ...{
132
+ mediaTypes: {
133
+ video: {
134
+ mimes: [
135
+ 'video/mp4',
136
+ 'video/mpeg',
137
+ ],
138
+ w: 250,
139
+ h: 300,
140
+ },
141
+ }
142
+ }
143
+ })).to.be.true;
144
+ });
145
+
146
+ it('should return false if there is no video sizes', () => {
147
+ expect(spec.isBidRequestValid({
148
+ ...bidRequest,
149
+ ...{
150
+ mediaTypes: {
151
+ video: {},
152
+ }
153
+ }
154
+ })).to.be.false;
155
+ });
119
156
  });
120
157
 
121
158
  describe('buildRequests', function () {
@@ -240,6 +277,14 @@ describe('InsticatorBidAdapter', function () {
240
277
  { w: 300, h: 600 },
241
278
  ]
242
279
  },
280
+ video: {
281
+ mimes: [
282
+ 'video/mp4',
283
+ 'video/mpeg',
284
+ ],
285
+ h: 300,
286
+ w: 250,
287
+ },
243
288
  ext: {
244
289
  gpid: bidRequest.ortb2Imp.ext.gpid,
245
290
  insticator: {
@@ -7,7 +7,7 @@ import { createEidsArray } from 'modules/userId/eids.js';
7
7
  import { deepAccess } from '../../../src/utils.js';
8
8
 
9
9
  describe('IndexexchangeAdapter', function () {
10
- const IX_SECURE_ENDPOINT = 'https://htlb.casalemedia.com/cygnus';
10
+ const IX_SECURE_ENDPOINT = 'https://htlb.casalemedia.com/openrtb/pbjs';
11
11
  const VIDEO_ENDPOINT_VERSION = 8.1;
12
12
  const BANNER_ENDPOINT_VERSION = 7.2;
13
13
 
@@ -0,0 +1,177 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from 'modules/lassoBidAdapter.js';
3
+ import { server } from '../../mocks/xhr';
4
+
5
+ const ENDPOINT_URL = 'https://trc.lhmos.com/prebid';
6
+
7
+ const bid = {
8
+ bidder: 'lasso',
9
+ params: {
10
+ adUnitId: 123456
11
+ },
12
+ auctionStart: Date.now(),
13
+ adUnitCode: 'adunit-code',
14
+ auctionId: 'cfa6f46d-4584-46e1-9c00-54769abb51e3',
15
+ bidderRequestId: 'a123b456c789d',
16
+ bidId: '123a456b789',
17
+ mediaTypes: {
18
+ banner: {
19
+ sizes: [[300, 250]]
20
+ }
21
+ },
22
+ sizes: [[300, 250]],
23
+ src: 'client',
24
+ transactionId: '26740296-0111-4b7a-80df-7196823026f4'
25
+ };
26
+
27
+ const bidderRequest = {
28
+ auctionId: 'cfa6f46d-4584-46e1-9c00-54769abb51e3',
29
+ auctionStart: Date.now(),
30
+ start: Date.now(),
31
+ biddeCode: 'lasso',
32
+ bidderRequestId: 'a123b456c789d',
33
+ bids: [bid],
34
+ timeout: 10000
35
+ };
36
+
37
+ describe('lassoBidAdapter', function () {
38
+ describe('All needed functions are available', function() {
39
+ it(`isBidRequestValid is present and type function`, function () {
40
+ expect(spec.isBidRequestValid).to.exist.and.to.be.a('function')
41
+ });
42
+
43
+ it(`buildRequests is present and type function`, function () {
44
+ expect(spec.buildRequests).to.exist.and.to.be.a('function')
45
+ });
46
+
47
+ it(`interpretResponse is present and type function`, function () {
48
+ expect(spec.interpretResponse).to.exist.and.to.be.a('function')
49
+ });
50
+
51
+ it(`onTimeout is present and type function`, function () {
52
+ expect(spec.onTimeout).to.exist.and.to.be.a('function')
53
+ });
54
+
55
+ it(`onBidWon is present and type function`, function () {
56
+ expect(spec.onBidWon).to.exist.and.to.be.a('function')
57
+ });
58
+ });
59
+
60
+ describe('isBidRequestValid', function () {
61
+ it('should return true when required params found', function () {
62
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
63
+ });
64
+ it('should return true when there are extra params', function () {
65
+ const bid = Object.assign({}, bid, {
66
+ params: {
67
+ adUnitId: 123456,
68
+ zone: 1,
69
+ publisher: 'test'
70
+ }
71
+ })
72
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
73
+ });
74
+ it('should return false when there are no params', function () {
75
+ const invalidBid = { ...bid };
76
+ delete invalidBid.params;
77
+ expect(spec.isBidRequestValid(invalidBid)).to.equal(false);
78
+ });
79
+ });
80
+
81
+ describe('buildRequests', function () {
82
+ const validBidRequests = spec.buildRequests([bid], bidderRequest);
83
+ expect(validBidRequests).to.be.an('array').that.is.not.empty;
84
+
85
+ const bidRequest = validBidRequests[0];
86
+
87
+ it('Returns valid bidRequest', function () {
88
+ expect(bidRequest).to.exist;
89
+ expect(bidRequest.method).to.exist;
90
+ expect(bidRequest.url).to.exist;
91
+ expect(bidRequest.data).to.exist;
92
+ });
93
+
94
+ it('Returns GET method', function() {
95
+ expect(bidRequest.method).to.exist;
96
+ expect(bidRequest.method).to.equal('GET');
97
+ });
98
+ });
99
+
100
+ describe('interpretResponse', function () {
101
+ let serverResponse = {
102
+ body: {
103
+ bidid: '123456789',
104
+ id: '33302780340222111',
105
+ bid: {
106
+ price: 1,
107
+ w: 728,
108
+ h: 90,
109
+ crid: 123456,
110
+ ad: '<script>console.log("ad");</script>',
111
+ mediaType: 'banner'
112
+ },
113
+ meta: {
114
+ cat: ['1', '2', '3', '4'],
115
+ advertiserDomains: ['lassomarketing.io'],
116
+ advertiserName: 'Lasso'
117
+ },
118
+ cur: 'USD',
119
+ netRevenue: false,
120
+ ttl: 300,
121
+ }
122
+ };
123
+
124
+ it('should get the correct bid response', function () {
125
+ let expectedResponse = {
126
+ requestId: '123456789',
127
+ cpm: 1,
128
+ currency: 'USD',
129
+ width: 728,
130
+ height: 90,
131
+ creativeId: 123456,
132
+ netRevenue: false,
133
+ ttl: 300,
134
+ ad: '<script>console.log("ad");</script>',
135
+ mediaType: 'banner',
136
+ meta: {
137
+ secondaryCatIds: ['1', '2', '3', '4'],
138
+ advertiserDomains: ['lassomarketing.io'],
139
+ advertiserName: 'Lasso',
140
+ mediaType: 'banner'
141
+ }
142
+ };
143
+ let result = spec.interpretResponse(serverResponse);
144
+ expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse));
145
+ });
146
+ });
147
+
148
+ describe('onTimeout', () => {
149
+ it('should send timeout', () => {
150
+ const timeoutData = {
151
+ bidder: 'lasso',
152
+ auctionId: 'cfa6f46d-4584-46e1-9c00-54769abb51e3',
153
+ dUnitCode: 'adunit-code',
154
+ bidId: '123a456b789',
155
+ params: {
156
+ adUnitId: 123456,
157
+ },
158
+ timeout: 3000
159
+ };
160
+ spec.onTimeout(timeoutData);
161
+
162
+ expect(server.requests[0].method).to.equal('POST');
163
+ expect(server.requests[0].url).to.equal(ENDPOINT_URL + '/timeout');
164
+ expect(JSON.parse(server.requests[0].requestBody)).to.deep.equal(timeoutData);
165
+ });
166
+ });
167
+
168
+ describe('onBidWon', () => {
169
+ it('should send bid won request', () => {
170
+ spec.onBidWon(bid);
171
+
172
+ expect(server.requests[0].method).to.equal('POST');
173
+ expect(server.requests[0].url).to.equal(ENDPOINT_URL + '/won');
174
+ expect(JSON.parse(server.requests[0].requestBody)).to.deep.equal(bid);
175
+ });
176
+ });
177
+ });