prebid.js 6.5.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/modules/.submodules.json +2 -1
  2. package/modules/adkernelBidAdapter.js +2 -1
  3. package/modules/admanBidAdapter.js +10 -4
  4. package/modules/adomikAnalyticsAdapter.js +23 -11
  5. package/modules/adqueryIdSystem.js +103 -0
  6. package/modules/adqueryIdSystem.md +35 -0
  7. package/modules/bliinkBidAdapter.js +2 -1
  8. package/modules/compassBidAdapter.js +9 -2
  9. package/modules/criteoBidAdapter.js +1 -1
  10. package/modules/criteoIdSystem.js +29 -7
  11. package/modules/glimpseBidAdapter.js +66 -44
  12. package/modules/idImportLibrary.js +45 -8
  13. package/modules/idImportLibrary.md +4 -0
  14. package/modules/improvedigitalBidAdapter.js +24 -2
  15. package/modules/nextMillenniumBidAdapter.js +3 -1
  16. package/modules/oguryBidAdapter.js +9 -2
  17. package/modules/onetagBidAdapter.js +4 -2
  18. package/modules/proxistoreBidAdapter.js +0 -2
  19. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  20. package/modules/richaudienceBidAdapter.js +3 -2
  21. package/modules/riseBidAdapter.js +1 -1
  22. package/modules/rtbhouseBidAdapter.js +14 -4
  23. package/modules/rtdModule/index.js +6 -5
  24. package/modules/showheroes-bsBidAdapter.js +13 -2
  25. package/modules/tappxBidAdapter.js +8 -5
  26. package/modules/teadsBidAdapter.js +1 -2
  27. package/modules/userId/eids.js +7 -1
  28. package/modules/userId/userId.md +8 -0
  29. package/modules/welectBidAdapter.js +106 -0
  30. package/package.json +1 -1
  31. package/src/hook.js +5 -1
  32. package/src/prebid.js +18 -4
  33. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  34. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  35. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  36. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  37. package/test/spec/modules/compassBidAdapter_spec.js +1 -0
  38. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  39. package/test/spec/modules/eids_spec.js +15 -0
  40. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  41. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  42. package/test/spec/modules/improvedigitalBidAdapter_spec.js +42 -0
  43. package/test/spec/modules/loglyliftBidAdapter_spec.js +1 -1
  44. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
  45. package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
  46. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  47. package/test/spec/modules/realTimeDataModule_spec.js +16 -3
  48. package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
  49. package/test/spec/modules/riseBidAdapter_spec.js +1 -1
  50. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  51. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  52. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  53. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  54. package/test/spec/modules/userId_spec.js +68 -19
  55. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  56. package/test/spec/unit/pbjs_api_spec.js +3 -1
@@ -13,6 +13,7 @@ const adomain = ['showheroes.com'];
13
13
 
14
14
  const gdpr = {
15
15
  'gdprConsent': {
16
+ 'apiVersion': 2,
16
17
  'consentString': 'BOEFEAyOEFEAyAHABDENAI4AAAB9vABAASA',
17
18
  'gdprApplies': true
18
19
  }
@@ -332,6 +333,7 @@ describe('shBidAdapter', function () {
332
333
  {
333
334
  'cpm': 5,
334
335
  'creativeId': 'c_38b373e1e31c18',
336
+ 'adUnitCode': 'adunit-code-1',
335
337
  'currency': 'EUR',
336
338
  'width': 640,
337
339
  'height': 480,
@@ -134,12 +134,6 @@ describe('Tappx bid adapter', function () {
134
134
  assert.isTrue(spec.isBidRequestValid(c_BIDREQUEST.bids[0]), JSON.stringify(c_BIDREQUEST));
135
135
  });
136
136
 
137
- it('should return false when params are missing', function () {
138
- let badBidRequestParam = JSON.parse(JSON.stringify(c_BIDREQUEST));
139
- delete badBidRequestParam.bids[0].params;
140
- assert.isFalse(spec.isBidRequestValid(badBidRequestParam.bids[0]));
141
- });
142
-
143
137
  it('should return false when tappxkey is missing', function () {
144
138
  let badBidRequestTpxkey = JSON.parse(JSON.stringify(c_BIDREQUEST)); ;
145
139
  delete badBidRequestTpxkey.bids[0].params.tappxkey;
@@ -165,21 +159,11 @@ describe('Tappx bid adapter', function () {
165
159
  assert.isTrue(spec.isBidRequestValid(badBidRequestNwEp.bids[0]));
166
160
  });
167
161
 
168
- it('should return false mimes param is missing', function () {
169
- let badBidRequest_mimes = c_BIDDERREQUEST_V;
170
- delete badBidRequest_mimes.bids.mediaTypes.video;
171
- badBidRequest_mimes.bids.mediaTypes.video = {};
172
- badBidRequest_mimes.bids.mediaTypes.video.context = 'instream';
173
- badBidRequest_mimes.bids.mediaTypes.video.playerSize = [320, 250];
174
- assert.isFalse(spec.isBidRequestValid(badBidRequest_mimes.bids), badBidRequest_mimes);
175
- });
176
-
177
162
  it('should return false for not instream/outstream requests', function () {
178
163
  let badBidRequest_v = c_BIDDERREQUEST_V;
179
164
  delete badBidRequest_v.bids.mediaTypes.banner;
180
165
  badBidRequest_v.bids.mediaTypes.video = {};
181
166
  badBidRequest_v.bids.mediaTypes.video.context = '';
182
- badBidRequest_v.bids.mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
183
167
  badBidRequest_v.bids.mediaTypes.video.playerSize = [320, 250];
184
168
  assert.isFalse(spec.isBidRequestValid(badBidRequest_v.bids));
185
169
  });
@@ -232,7 +216,6 @@ describe('Tappx bid adapter', function () {
232
216
  validBidRequests_V[0].mediaTypes.video = {};
233
217
  validBidRequests_V[0].mediaTypes.video.playerSize = [640, 480];
234
218
  validBidRequests_V[0].mediaTypes.video.context = 'instream';
235
- validBidRequests_V[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
236
219
 
237
220
  bidderRequest_V.bids.mediaTypes.context = 'instream';
238
221
 
@@ -252,7 +235,6 @@ describe('Tappx bid adapter', function () {
252
235
  validBidRequests_Voutstream[0].mediaTypes.video = {};
253
236
  validBidRequests_Voutstream[0].mediaTypes.video.playerSize = [640, 480];
254
237
  validBidRequests_Voutstream[0].mediaTypes.video.context = 'outstream';
255
- validBidRequests_Voutstream[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
256
238
 
257
239
  bidderRequest_VOutstream.bids.mediaTypes.context = 'outstream';
258
240
 
@@ -273,7 +255,6 @@ describe('Tappx bid adapter', function () {
273
255
  validBidRequests_Voutstream[0].mediaTypes.video.rewarded = 1;
274
256
  validBidRequests_Voutstream[0].mediaTypes.video.playerSize = [640, 480];
275
257
  validBidRequests_Voutstream[0].mediaTypes.video.context = 'outstream';
276
- validBidRequests_Voutstream[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
277
258
 
278
259
  bidderRequest_VOutstream.bids.mediaTypes.context = 'outstream';
279
260
 
@@ -614,15 +614,13 @@ describe('teadsBidAdapter', () => {
614
614
  }
615
615
  ];
616
616
 
617
- it('should add gpid if ortb2Imp.ext.data.pbadslot is present and is non empty (and ortb2Imp.ext.data.adserver.adslot is not present)', function () {
617
+ it('should add gpid if ortb2Imp.ext.gpid is present and is non empty', function () {
618
618
  const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
619
619
  return {
620
620
  ...bidRequest,
621
621
  ortb2Imp: {
622
622
  ext: {
623
- data: {
624
- pbadslot: '1111/home-left-' + index
625
- }
623
+ gpid: '1111/home-left-' + index
626
624
  }
627
625
  }
628
626
  };
@@ -635,41 +633,12 @@ describe('teadsBidAdapter', () => {
635
633
  expect(payload.data[1].gpid).to.equal('1111/home-left-1');
636
634
  });
637
635
 
638
- it('should add gpid if ortb2Imp.ext.data.pbadslot is present and is non empty (even if ortb2Imp.ext.data.adserver.adslot is present and is non empty too)', function () {
639
- const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
640
- return {
641
- ...bidRequest,
642
- ortb2Imp: {
643
- ext: {
644
- data: {
645
- pbadslot: '1111/home-left-' + index,
646
- adserver: {
647
- adslot: '1111/home-left/div-' + index
648
- }
649
- }
650
- }
651
- }
652
- };
653
- }
654
- );
655
- const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
656
- const payload = JSON.parse(request.data);
657
-
658
- expect(payload.data[0].gpid).to.equal('1111/home-left-0');
659
- expect(payload.data[1].gpid).to.equal('1111/home-left-1');
660
- });
661
-
662
- it('should not add gpid if both ortb2Imp.ext.data.pbadslot and ortb2Imp.ext.data.adserver.adslot are present but empty', function () {
636
+ it('should not add gpid if ortb2Imp.ext.gpid is present but empty', function () {
663
637
  const updatedBidRequests = bidRequests.map(bidRequest => ({
664
638
  ...bidRequest,
665
639
  ortb2Imp: {
666
640
  ext: {
667
- data: {
668
- pbadslot: '',
669
- adserver: {
670
- adslot: ''
671
- }
672
- }
641
+ gpid: ''
673
642
  }
674
643
  }
675
644
  }));
@@ -682,36 +651,22 @@ describe('teadsBidAdapter', () => {
682
651
  });
683
652
  });
684
653
 
685
- it('should not add gpid if both ortb2Imp.ext.data.pbadslot and ortb2Imp.ext.data.adserver.adslot are not present', function () {
686
- const request = spec.buildRequests(bidRequests, bidderResquestDefault);
654
+ it('should not add gpid if ortb2Imp.ext.gpid is not present', function () {
655
+ const updatedBidRequests = bidRequests.map(bidRequest => ({
656
+ ...bidRequest,
657
+ ortb2Imp: {
658
+ ext: {
659
+ }
660
+ }
661
+ }));
662
+
663
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
687
664
  const payload = JSON.parse(request.data);
688
665
 
689
666
  return payload.data.forEach(bid => {
690
667
  expect(bid).not.to.have.property('gpid');
691
668
  });
692
669
  });
693
-
694
- it('should add gpid if ortb2Imp.ext.data.pbadslot is not present but ortb2Imp.ext.data.adserver.adslot is present and is non empty', function () {
695
- const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
696
- return {
697
- ...bidRequest,
698
- ortb2Imp: {
699
- ext: {
700
- data: {
701
- adserver: {
702
- adslot: '1111/home-left-' + index
703
- }
704
- }
705
- }
706
- }
707
- };
708
- });
709
- const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
710
- const payload = JSON.parse(request.data);
711
-
712
- expect(payload.data[0].gpid).to.equal('1111/home-left-0');
713
- expect(payload.data[1].gpid).to.equal('1111/home-left-1');
714
- });
715
670
  });
716
671
 
717
672
  function checkMediaTypesSizes(mediaTypes, expectedSizes) {
@@ -49,6 +49,7 @@ import {flocIdSubmodule} from 'modules/flocIdSystem.js'
49
49
  import {amxIdSubmodule} from '../../../modules/amxIdSystem.js';
50
50
  import {akamaiDAPIdSubmodule} from 'modules/akamaiDAPIdSystem.js'
51
51
  import {kinessoIdSubmodule} from 'modules/kinessoIdSystem.js'
52
+ import {adqueryIdSubmodule} from 'modules/adqueryIdSystem.js';
52
53
  import * as mockGpt from '../integration/faker/googletag.js';
53
54
 
54
55
  let assert = require('chai').assert;
@@ -559,7 +560,7 @@ describe('User ID', function () {
559
560
  });
560
561
 
561
562
  it('handles config with no usersync object', function () {
562
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
563
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
563
564
  init(config);
564
565
  config.setConfig({});
565
566
  // usersync is undefined, and no logInfo message for 'User ID - usersync config updated'
@@ -567,14 +568,14 @@ describe('User ID', function () {
567
568
  });
568
569
 
569
570
  it('handles config with empty usersync object', function () {
570
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
571
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
571
572
  init(config);
572
573
  config.setConfig({userSync: {}});
573
574
  expect(typeof utils.logInfo.args[0]).to.equal('undefined');
574
575
  });
575
576
 
576
577
  it('handles config with usersync and userIds that are empty objs', function () {
577
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
578
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
578
579
  init(config);
579
580
  config.setConfig({
580
581
  userSync: {
@@ -585,7 +586,7 @@ describe('User ID', function () {
585
586
  });
586
587
 
587
588
  it('handles config with usersync and userIds with empty names or that dont match a submodule.name', function () {
588
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
589
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, merkleIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
589
590
  init(config);
590
591
  config.setConfig({
591
592
  userSync: {
@@ -602,7 +603,7 @@ describe('User ID', function () {
602
603
  });
603
604
 
604
605
  it('config with 1 configurations should create 1 submodules', function () {
605
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
606
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
606
607
  init(config);
607
608
  config.setConfig(getConfigMock(['unifiedId', 'unifiedid', 'cookie']));
608
609
 
@@ -623,8 +624,8 @@ describe('User ID', function () {
623
624
  expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 1 submodules');
624
625
  });
625
626
 
626
- it('config with 23 configurations should result in 23 submodules add', function () {
627
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, liveIntentIdSubmodule, britepoolIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
627
+ it('config with 24 configurations should result in 24 submodules add', function () {
628
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, liveIntentIdSubmodule, britepoolIdSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
628
629
  init(config);
629
630
  config.setConfig({
630
631
  userSync: {
@@ -689,14 +690,17 @@ describe('User ID', function () {
689
690
  }, {
690
691
  name: 'kpuid',
691
692
  storage: {name: 'kpuid', type: 'cookie'}
693
+ }, {
694
+ name: 'qid',
695
+ storage: {name: 'qid', type: 'html5'}
692
696
  }]
693
697
  }
694
698
  });
695
- expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 23 submodules');
699
+ expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 24 submodules');
696
700
  });
697
701
 
698
702
  it('config syncDelay updates module correctly', function () {
699
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
703
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
700
704
 
701
705
  init(config);
702
706
  config.setConfig({
@@ -712,7 +716,7 @@ describe('User ID', function () {
712
716
  });
713
717
 
714
718
  it('config auctionDelay updates module correctly', function () {
715
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
719
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
716
720
  init(config);
717
721
  config.setConfig({
718
722
  userSync: {
@@ -727,7 +731,7 @@ describe('User ID', function () {
727
731
  });
728
732
 
729
733
  it('config auctionDelay defaults to 0 if not a number', function () {
730
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
734
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, netIdSubmodule, nextrollIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, flocIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
731
735
  init(config);
732
736
  config.setConfig({
733
737
  userSync: {
@@ -1823,7 +1827,38 @@ describe('User ID', function () {
1823
1827
  }, {adUnits});
1824
1828
  });
1825
1829
 
1826
- it('test hook when pubCommonId, unifiedId, id5Id, identityLink, britepoolId, intentIqId, zeotapIdPlus, netId, haloId, Criteo, UID 2.0, admixerId, amxId, dmdId, kpuid and mwOpenLinkId have data to pass', function (done) {
1830
+ it('test hook from qid html5', (done) => {
1831
+ // simulate existing localStorage values
1832
+ localStorage.setItem('qid', 'testqid');
1833
+ localStorage.setItem('qid_exp', '');
1834
+
1835
+ setSubmoduleRegistry([adqueryIdSubmodule]);
1836
+ init(config);
1837
+ config.setConfig(getConfigMock(['qid', 'qid', 'html5']));
1838
+
1839
+ requestBidsHook(() => {
1840
+ adUnits.forEach((adUnit) => {
1841
+ adUnit.bids.forEach((bid) => {
1842
+ expect(bid).to.have.deep.nested.property('userId.qid');
1843
+ expect(bid.userId.qid).to.equal('testqid');
1844
+ expect(bid.userIdAsEids[0]).to.deep.equal({
1845
+ source: 'adquery.io',
1846
+ uids: [{
1847
+ id: 'testqid',
1848
+ atype: 1,
1849
+ }]
1850
+ });
1851
+ });
1852
+ });
1853
+
1854
+ // clear LS
1855
+ localStorage.removeItem('qid');
1856
+ localStorage.removeItem('qid_exp');
1857
+ done();
1858
+ }, {adUnits});
1859
+ });
1860
+
1861
+ it('test hook when pubCommonId, unifiedId, id5Id, identityLink, britepoolId, intentIqId, zeotapIdPlus, netId, haloId, Criteo, UID 2.0, admixerId, amxId, dmdId, kpuid, qid and mwOpenLinkId have data to pass', function (done) {
1827
1862
  coreStorage.setCookie('pubcid', 'testpubcid', (new Date(Date.now() + 5000).toUTCString()));
1828
1863
  coreStorage.setCookie('unifiedid', JSON.stringify({'TDID': 'testunifiedid'}), (new Date(Date.now() + 5000).toUTCString()));
1829
1864
  coreStorage.setCookie('id5id', JSON.stringify({'universal_uid': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
@@ -1840,12 +1875,13 @@ describe('User ID', function () {
1840
1875
  coreStorage.setCookie('admixerId', 'testadmixerId', (new Date(Date.now() + 5000).toUTCString()));
1841
1876
  coreStorage.setCookie('deepintentId', 'testdeepintentId', (new Date(Date.now() + 5000).toUTCString()));
1842
1877
  coreStorage.setCookie('kpuid', 'KINESSO_ID', (new Date(Date.now() + 5000).toUTCString()));
1843
-
1844
1878
  // amxId only supports localStorage
1845
1879
  localStorage.setItem('amxId', 'test_amxid_id');
1846
1880
  localStorage.setItem('amxId_exp', (new Date(Date.now() + 5000)).toUTCString());
1847
-
1848
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, britepoolIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
1881
+ // qid only supports localStorage
1882
+ localStorage.setItem('qid', 'testqid');
1883
+ localStorage.setItem('qid_exp', (new Date(Date.now() + 5000)).toUTCString());
1884
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, britepoolIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
1849
1885
  init(config);
1850
1886
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie'],
1851
1887
  ['unifiedId', 'unifiedid', 'cookie'],
@@ -1864,7 +1900,8 @@ describe('User ID', function () {
1864
1900
  ['admixerId', 'admixerId', 'cookie'],
1865
1901
  ['amxId', 'amxId', 'html5'],
1866
1902
  ['deepintentId', 'deepintentId', 'cookie'],
1867
- ['kpuid', 'kpuid', 'cookie']));
1903
+ ['kpuid', 'kpuid', 'cookie'],
1904
+ ['qid', 'qid', 'html5']));
1868
1905
 
1869
1906
  requestBidsHook(function () {
1870
1907
  adUnits.forEach(unit => {
@@ -1922,7 +1959,10 @@ describe('User ID', function () {
1922
1959
  expect(bid).to.have.deep.nested.property('userId.kpuid');
1923
1960
  expect(bid.userId.kpuid).to.equal('KINESSO_ID');
1924
1961
 
1925
- expect(bid.userIdAsEids.length).to.equal(17);
1962
+ expect(bid).to.have.deep.nested.property('userId.qid');
1963
+ expect(bid.userId.qid).to.equal('testqid');
1964
+
1965
+ expect(bid.userIdAsEids.length).to.equal(18);
1926
1966
  });
1927
1967
  });
1928
1968
  coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE);
@@ -1943,6 +1983,8 @@ describe('User ID', function () {
1943
1983
  coreStorage.setCookie('kpuid', EXPIRED_COOKIE_DATE);
1944
1984
  localStorage.removeItem('amxId');
1945
1985
  localStorage.removeItem('amxId_exp');
1986
+ localStorage.removeItem('qid');
1987
+ localStorage.removeItem('qid_exp');
1946
1988
  done();
1947
1989
  }, {adUnits});
1948
1990
  });
@@ -2132,8 +2174,10 @@ describe('User ID', function () {
2132
2174
  localStorage.setItem('amxId', 'test_amxid_id');
2133
2175
  localStorage.setItem('amxId_exp', new Date(Date.now() + 5000).toUTCString())
2134
2176
  coreStorage.setCookie('kpuid', 'KINESSO_ID', (new Date(Date.now() + 5000).toUTCString()));
2177
+ localStorage.setItem('qid', 'testqid');
2178
+ localStorage.setItem('qid_exp', new Date(Date.now() + 5000).toUTCString())
2135
2179
 
2136
- setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, britepoolIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule]);
2180
+ setSubmoduleRegistry([sharedIdSystemSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, britepoolIdSubmodule, netIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule, dmdIdSubmodule, akamaiDAPIdSubmodule, amxIdSubmodule, kinessoIdSubmodule, adqueryIdSubmodule]);
2137
2181
  init(config);
2138
2182
 
2139
2183
  config.setConfig({
@@ -2171,6 +2215,8 @@ describe('User ID', function () {
2171
2215
  name: 'amxId', storage: {name: 'amxId', type: 'html5'}
2172
2216
  }, {
2173
2217
  name: 'kpuid', storage: {name: 'kpuid', type: 'cookie'}
2218
+ }, {
2219
+ name: 'qid', storage: {name: 'qid', type: 'html5'}
2174
2220
  }]
2175
2221
  }
2176
2222
  });
@@ -2242,7 +2288,10 @@ describe('User ID', function () {
2242
2288
 
2243
2289
  expect(bid).to.have.deep.nested.property('userId.kpuid');
2244
2290
  expect(bid.userId.kpuid).to.equal('KINESSO_ID');
2245
- expect(bid.userIdAsEids.length).to.equal(15);
2291
+
2292
+ expect(bid).to.have.deep.nested.property('userId.qid');
2293
+ expect(bid.userId.qid).to.equal('testqid');
2294
+ expect(bid.userIdAsEids.length).to.equal(16);
2246
2295
  });
2247
2296
  });
2248
2297
  coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE);
@@ -0,0 +1,211 @@
1
+ import { expect } from 'chai';
2
+ import { spec as adapter } from 'modules/welectBidAdapter.js';
3
+
4
+ describe('WelectAdapter', function () {
5
+ describe('Check methods existance', function () {
6
+ it('exists and is a function', function () {
7
+ expect(adapter.isBidRequestValid).to.exist.and.to.be.a('function');
8
+ });
9
+ it('exists and is a function', function () {
10
+ expect(adapter.buildRequests).to.exist.and.to.be.a('function');
11
+ });
12
+ it('exists and is a function', function () {
13
+ expect(adapter.interpretResponse).to.exist.and.to.be.a('function');
14
+ });
15
+ });
16
+
17
+ describe('Check method isBidRequestValid return', function () {
18
+ let bid = {
19
+ bidder: 'welect',
20
+ params: {
21
+ placementId: 'exampleAlias',
22
+ domain: 'www.welect.de'
23
+ },
24
+ sizes: [[640, 360]],
25
+ mediaTypes: {
26
+ video: {
27
+ context: 'instream'
28
+ }
29
+ },
30
+ };
31
+ let bid2 = {
32
+ bidder: 'welect',
33
+ params: {
34
+ domain: 'www.welect.de'
35
+ },
36
+ mediaTypes: {
37
+ video: {
38
+ context: 'instream',
39
+ playerSize: [640, 360]
40
+ }
41
+ },
42
+ };
43
+
44
+ it('should be true', function () {
45
+ expect(adapter.isBidRequestValid(bid)).to.be.true;
46
+ });
47
+
48
+ it('should be false because the placementId is missing', function () {
49
+ expect(adapter.isBidRequestValid(bid2)).to.be.false;
50
+ });
51
+ });
52
+
53
+ describe('Check buildRequests method', function () {
54
+ // Bids to be formatted
55
+ let bid1 = {
56
+ bidder: 'welect',
57
+ params: {
58
+ placementId: 'exampleAlias'
59
+ },
60
+ sizes: [[640, 360]],
61
+ mediaTypes: {
62
+ video: {
63
+ context: 'instream'
64
+ }
65
+ },
66
+ bidId: 'abdc'
67
+ };
68
+ let bid2 = {
69
+ bidder: 'welect',
70
+ params: {
71
+ placementId: 'exampleAlias',
72
+ domain: 'www.welect2.de'
73
+ },
74
+ sizes: [[640, 360]],
75
+ mediaTypes: {
76
+ video: {
77
+ context: 'instream'
78
+ }
79
+ },
80
+ bidId: 'abdc',
81
+ gdprConsent: {
82
+ gdprApplies: 1,
83
+ gdprConsent: 'some_string'
84
+ }
85
+ };
86
+
87
+ let data1 = {
88
+ bid_id: 'abdc',
89
+ width: 640,
90
+ height: 360
91
+ }
92
+
93
+ let data2 = {
94
+ bid_id: 'abdc',
95
+ width: 640,
96
+ height: 360,
97
+ gdpr_consent: {
98
+ gdprApplies: 1,
99
+ tcString: 'some_string'
100
+ }
101
+ }
102
+
103
+ // Formatted requets
104
+ let request1 = {
105
+ method: 'POST',
106
+ url: 'https://www.welect.de/api/v2/preflight/exampleAlias',
107
+ data: data1,
108
+ options: {
109
+ contentType: 'application/json',
110
+ withCredentials: false,
111
+ crossOrigin: true,
112
+ }
113
+ };
114
+
115
+ let request2 = {
116
+ method: 'POST',
117
+ url: 'https://www.welect2.de/api/v2/preflight/exampleAlias',
118
+ data: data2,
119
+ options: {
120
+ contentType: 'application/json',
121
+ withCredentials: false,
122
+ crossOrigin: true,
123
+ }
124
+ }
125
+
126
+ it('defaults to www.welect.de, without gdpr object', function () {
127
+ expect(adapter.buildRequests([bid1])).to.deep.equal([request1]);
128
+ })
129
+
130
+ it('must return the right formatted requests, with gdpr object', function () {
131
+ expect(adapter.buildRequests([bid2])).to.deep.equal([request2]);
132
+ });
133
+ });
134
+
135
+ describe('Check interpretResponse method return', function () {
136
+ // invalid server response
137
+ let unavailableResponse = {
138
+ body: {
139
+ available: false
140
+ }
141
+ };
142
+
143
+ let availableResponse = {
144
+ body: {
145
+ available: true,
146
+ bidResponse: {
147
+ ad: {
148
+ video: 'some vast url'
149
+ },
150
+ meta: {
151
+ advertiserDomains: [],
152
+ },
153
+ cpm: 17,
154
+ creativeId: 'svmpreview',
155
+ currency: 'EUR',
156
+ netRevenue: true,
157
+ requestId: 'some bid id',
158
+ ttl: 120,
159
+ vastUrl: 'some vast url',
160
+ height: 640,
161
+ width: 320
162
+ }
163
+ }
164
+ }
165
+ // bid Request
166
+ let bid = {
167
+ data: {
168
+ bid_id: 'some bid id',
169
+ width: 640,
170
+ height: 320,
171
+ gdpr_consent: {
172
+ gdprApplies: 1,
173
+ tcString: 'some_string'
174
+ }
175
+ },
176
+ method: 'POST',
177
+ url: 'https://www.welect.de/api/v2/preflight/exampleAlias',
178
+ options: {
179
+ contentType: 'application/json',
180
+ withCredentials: false,
181
+ crossOrigin: true,
182
+ }
183
+ };
184
+ // Formatted reponse
185
+ let result = {
186
+ ad: {
187
+ video: 'some vast url'
188
+ },
189
+ meta: {
190
+ advertiserDomains: []
191
+ },
192
+ cpm: 17,
193
+ creativeId: 'svmpreview',
194
+ currency: 'EUR',
195
+ height: 640,
196
+ netRevenue: true,
197
+ requestId: 'some bid id',
198
+ ttl: 120,
199
+ vastUrl: 'some vast url',
200
+ width: 320
201
+ }
202
+
203
+ it('if response reflects unavailability, should be empty', function () {
204
+ expect(adapter.interpretResponse(unavailableResponse, bid)).to.deep.equal([]);
205
+ });
206
+
207
+ it('if response reflects availability, should equal result', function () {
208
+ expect(adapter.interpretResponse(availableResponse, bid)).to.deep.equal([result])
209
+ })
210
+ });
211
+ });
@@ -1135,13 +1135,15 @@ describe('Unit: Prebid Module', function () {
1135
1135
  height: 0
1136
1136
  }
1137
1137
  },
1138
- getElementsByTagName: sinon.stub()
1138
+ getElementsByTagName: sinon.stub(),
1139
+ querySelector: sinon.stub()
1139
1140
  };
1140
1141
 
1141
1142
  elStub = {
1142
1143
  insertBefore: sinon.stub()
1143
1144
  };
1144
1145
  doc.getElementsByTagName.returns([elStub]);
1146
+ doc.querySelector.returns(elStub);
1145
1147
 
1146
1148
  spyLogError = sinon.spy(utils, 'logError');
1147
1149
  spyLogMessage = sinon.spy(utils, 'logMessage');