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
@@ -7,9 +7,8 @@ import sinon from 'sinon';
7
7
  let expect = require('chai').expect;
8
8
 
9
9
  const CONFIG_PARAMS = {
10
- endpoint: 'https://test/id',
11
- vendor: 'idsv2',
12
- sv_cid: '5344_04531',
10
+ endpoint: undefined,
11
+ ssp_ids: ['ssp-1'],
13
12
  sv_pubid: '11314',
14
13
  sv_domain: 'www.testDomain.com',
15
14
  sv_session: 'testsession'
@@ -38,6 +37,42 @@ function mockResponse(
38
37
  }
39
38
 
40
39
  describe('Merkle System', function () {
40
+ describe('merkleIdSystem.decode()', function() {
41
+ it('provides multiple Merkle IDs (EID) from a stored object', function() {
42
+ let storage = {
43
+ merkleId: [{
44
+ id: 'some-random-id-value', ext: { enc: 1, keyID: 16, idName: 'pamId', ssp: 'ssp1' }
45
+ }, {
46
+ id: 'another-random-id-value',
47
+ ext: {
48
+ enc: 1,
49
+ idName: 'pamId',
50
+ third: 4,
51
+ ssp: 'ssp2'
52
+ }
53
+ }],
54
+ _svsid: 'some-identifier'
55
+ };
56
+
57
+ expect(merkleIdSubmodule.decode(storage)).to.deep.equal({
58
+ merkleId: storage.merkleId
59
+ });
60
+ });
61
+
62
+ it('can decode legacy stored object', function() {
63
+ let merkleId = {'pam_id': {'id': 'testmerkleId', 'keyID': 1}};
64
+
65
+ expect(merkleIdSubmodule.decode(merkleId)).to.deep.equal({
66
+ merkleId: {'id': 'testmerkleId', 'keyID': 1}
67
+ });
68
+ })
69
+
70
+ it('returns undefined', function() {
71
+ let merkleId = {};
72
+ expect(merkleIdSubmodule.decode(merkleId)).to.be.undefined;
73
+ })
74
+ });
75
+
41
76
  describe('Merkle System getId()', function () {
42
77
  const callbackSpy = sinon.spy();
43
78
  let sandbox;
@@ -59,60 +94,32 @@ describe('Merkle System', function () {
59
94
  ajaxStub.restore();
60
95
  });
61
96
 
62
- it('getId() should fail on missing vendor', function () {
63
- let config = {
64
- params: {
65
- ...CONFIG_PARAMS,
66
- vendor: undefined
67
- },
68
- storage: STORAGE_PARAMS
69
- };
70
-
71
- let submoduleCallback = merkleIdSubmodule.getId(config, undefined);
72
- expect(submoduleCallback).to.be.undefined;
73
- expect(utils.logError.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule requires a valid vendor to be defined');
74
- });
75
-
76
- it('getId() should fail on missing vendor', function () {
77
- let config = {
78
- params: {
79
- ...CONFIG_PARAMS,
80
- vendor: undefined
81
- },
82
- storage: STORAGE_PARAMS
83
- };
84
-
85
- let submoduleCallback = merkleIdSubmodule.getId(config, undefined);
86
- expect(submoduleCallback).to.be.undefined;
87
- expect(utils.logError.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule requires a valid vendor to be defined');
88
- });
89
-
90
- it('getId() should fail on missing sv_cid', function () {
97
+ it('getId() should fail on missing sv_pubid', function () {
91
98
  let config = {
92
99
  params: {
93
100
  ...CONFIG_PARAMS,
94
- sv_cid: undefined
101
+ sv_pubid: undefined
95
102
  },
96
103
  storage: STORAGE_PARAMS
97
104
  };
98
105
 
99
106
  let submoduleCallback = merkleIdSubmodule.getId(config, undefined);
100
107
  expect(submoduleCallback).to.be.undefined;
101
- expect(utils.logError.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule requires a valid sv_cid string to be defined');
108
+ expect(utils.logError.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule requires a valid sv_pubid string to be defined');
102
109
  });
103
110
 
104
- it('getId() should fail on missing sv_pubid', function () {
111
+ it('getId() should fail on missing ssp_ids', function () {
105
112
  let config = {
106
113
  params: {
107
114
  ...CONFIG_PARAMS,
108
- sv_pubid: undefined
115
+ ssp_ids: undefined
109
116
  },
110
117
  storage: STORAGE_PARAMS
111
118
  };
112
119
 
113
120
  let submoduleCallback = merkleIdSubmodule.getId(config, undefined);
114
121
  expect(submoduleCallback).to.be.undefined;
115
- expect(utils.logError.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule requires a valid sv_pubid string to be defined');
122
+ expect(utils.logError.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule requires a valid ssp_ids array to be defined');
116
123
  });
117
124
 
118
125
  it('getId() should warn on missing endpoint', function () {
@@ -140,6 +147,20 @@ describe('Merkle System', function () {
140
147
  submoduleCallback(callbackSpy);
141
148
  expect(callbackSpy.calledOnce).to.be.true;
142
149
  });
150
+
151
+ it('getId() does not handle consent strings', function () {
152
+ let config = {
153
+ params: {
154
+ ...CONFIG_PARAMS,
155
+ ssp_ids: []
156
+ },
157
+ storage: STORAGE_PARAMS
158
+ };
159
+
160
+ let submoduleCallback = merkleIdSubmodule.getId(config, { gdprApplies: true });
161
+ expect(submoduleCallback).to.be.undefined;
162
+ expect(utils.logError.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule does not currently handle consent strings');
163
+ });
143
164
  });
144
165
 
145
166
  describe('Merkle System extendId()', function () {
@@ -649,7 +649,6 @@ describe('Parrable ID System', function() {
649
649
  writeParrableCookie({ eid: P_COOKIE_EID, ibaOptout: true });
650
650
  init(config);
651
651
  setSubmoduleRegistry([parrableIdSubmodule]);
652
- config.setConfig(getConfigMock());
653
652
  });
654
653
 
655
654
  afterEach(function() {
@@ -659,6 +658,7 @@ describe('Parrable ID System', function() {
659
658
  });
660
659
 
661
660
  it('when a stored Parrable ID exists it is added to bids', function(done) {
661
+ config.setConfig(getConfigMock());
662
662
  requestBidsHook(function() {
663
663
  adUnits.forEach(unit => {
664
664
  unit.bids.forEach(bid => {
@@ -685,6 +685,7 @@ describe('Parrable ID System', function() {
685
685
  it('supplies an optout reason when the EID is missing due to CCPA non-consent', function(done) {
686
686
  // the ID system itself will not write a cookie with an EID when CCPA=true
687
687
  writeParrableCookie({ ccpaOptout: true });
688
+ config.setConfig(getConfigMock());
688
689
 
689
690
  requestBidsHook(function() {
690
691
  adUnits.forEach(unit => {
@@ -164,6 +164,8 @@ const MOCK = {
164
164
  'bids': [
165
165
  {
166
166
  'bidder': 'pubmatic',
167
+ 'adapterCode': 'pubmatic',
168
+ 'bidderCode': 'pubmatic',
167
169
  'params': {
168
170
  'publisherId': '1001',
169
171
  'video': {
@@ -181,6 +183,8 @@ const MOCK = {
181
183
  },
182
184
  {
183
185
  'bidder': 'pubmatic',
186
+ 'adapterCode': 'pubmatic',
187
+ 'bidderCode': 'pubmatic',
184
188
  'params': {
185
189
  'publisherId': '1001',
186
190
  'kgpv': 'this-is-a-kgpv'
@@ -940,6 +944,7 @@ describe('pubmatic analytics adapter', function () {
940
944
 
941
945
  it('Logger: best case + win tracker in case of Bidder Aliases', function() {
942
946
  MOCK.BID_REQUESTED['bids'][0]['bidder'] = 'pubmatic_alias';
947
+ MOCK.BID_REQUESTED['bids'][0]['bidderCode'] = 'pubmatic_alias';
943
948
  adapterManager.aliasRegistry['pubmatic_alias'] = 'pubmatic';
944
949
 
945
950
  sandbox.stub($$PREBID_GLOBAL$$, 'getHighestCpmBids').callsFake((key) => {
@@ -1051,5 +1056,117 @@ describe('pubmatic analytics adapter', function () {
1051
1056
  expect(data.en).to.equal('1.23');
1052
1057
  expect(data.piid).to.equal('partnerImpressionID-1');
1053
1058
  });
1059
+
1060
+ it('Logger: best case + win tracker in case of GroupM as alternate bidder', function() {
1061
+ MOCK.BID_REQUESTED['bids'][0]['bidderCode'] = 'groupm';
1062
+ sandbox.stub($$PREBID_GLOBAL$$, 'getHighestCpmBids').callsFake((key) => {
1063
+ return [MOCK.BID_RESPONSE[0], MOCK.BID_RESPONSE[1]]
1064
+ });
1065
+
1066
+ config.setConfig({
1067
+ testGroupId: 15
1068
+ });
1069
+
1070
+ events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
1071
+ events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
1072
+ events.emit(BID_RESPONSE, MOCK.BID_RESPONSE[0]);
1073
+ events.emit(BID_RESPONSE, MOCK.BID_RESPONSE[1]);
1074
+ events.emit(BIDDER_DONE, MOCK.BIDDER_DONE);
1075
+ events.emit(AUCTION_END, MOCK.AUCTION_END);
1076
+ events.emit(SET_TARGETING, MOCK.SET_TARGETING);
1077
+ events.emit(BID_WON, MOCK.BID_WON[0]);
1078
+ events.emit(BID_WON, MOCK.BID_WON[1]);
1079
+
1080
+ clock.tick(2000 + 1000);
1081
+ expect(requests.length).to.equal(3); // 1 logger and 2 win-tracker
1082
+ let request = requests[2]; // logger is executed late, trackers execute first
1083
+ expect(request.url).to.equal('https://t.pubmatic.com/wl?pubid=9999');
1084
+ let data = getLoggerJsonFromRequest(request.requestBody);
1085
+ expect(data.pubid).to.equal('9999');
1086
+ expect(data.pid).to.equal('1111');
1087
+ expect(data.pdvid).to.equal('20');
1088
+ expect(data.iid).to.equal('25c6d7f5-699a-4bfc-87c9-996f915341fa');
1089
+ expect(data.to).to.equal('3000');
1090
+ expect(data.purl).to.equal('http://www.test.com/page.html');
1091
+ expect(data.orig).to.equal('www.test.com');
1092
+ expect(data.tst).to.equal(1519767016);
1093
+ expect(data.tgid).to.equal(15);
1094
+ expect(data.s).to.be.an('array');
1095
+ expect(data.s.length).to.equal(2);
1096
+
1097
+ // slot 1
1098
+ expect(data.s[0].sn).to.equal('/19968336/header-bid-tag-0');
1099
+ expect(data.s[0].sz).to.deep.equal(['640x480']);
1100
+ expect(data.s[0].ps).to.be.an('array');
1101
+ expect(data.s[0].ps.length).to.equal(1);
1102
+ expect(data.s[0].ps[0].pn).to.equal('pubmatic');
1103
+ expect(data.s[0].ps[0].bc).to.equal('groupm');
1104
+ expect(data.s[0].ps[0].bidid).to.equal('2ecff0db240757');
1105
+ expect(data.s[0].ps[0].piid).to.equal('partnerImpressionID-1');
1106
+ expect(data.s[0].ps[0].db).to.equal(0);
1107
+ expect(data.s[0].ps[0].kgpv).to.equal('/19968336/header-bid-tag-0');
1108
+ expect(data.s[0].ps[0].kgpsv).to.equal('/19968336/header-bid-tag-0');
1109
+ expect(data.s[0].ps[0].psz).to.equal('640x480');
1110
+ expect(data.s[0].ps[0].eg).to.equal(1.23);
1111
+ expect(data.s[0].ps[0].en).to.equal(1.23);
1112
+ expect(data.s[0].ps[0].di).to.equal('');
1113
+ expect(data.s[0].ps[0].dc).to.equal('');
1114
+ expect(data.s[0].ps[0].l1).to.equal(3214);
1115
+ expect(data.s[0].ps[0].l2).to.equal(0);
1116
+ expect(data.s[0].ps[0].ss).to.equal(0);
1117
+ expect(data.s[0].ps[0].t).to.equal(0);
1118
+ expect(data.s[0].ps[0].wb).to.equal(1);
1119
+ expect(data.s[0].ps[0].af).to.equal('video');
1120
+ expect(data.s[0].ps[0].ocpm).to.equal(1.23);
1121
+ expect(data.s[0].ps[0].ocry).to.equal('USD');
1122
+
1123
+ // slot 2
1124
+ expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
1125
+ expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
1126
+ expect(data.s[1].ps).to.be.an('array');
1127
+ expect(data.s[1].ps.length).to.equal(1);
1128
+ expect(data.s[1].ps[0].pn).to.equal('pubmatic');
1129
+ expect(data.s[1].ps[0].bc).to.equal('pubmatic');
1130
+ expect(data.s[1].ps[0].bidid).to.equal('3bd4ebb1c900e2');
1131
+ expect(data.s[1].ps[0].piid).to.equal('partnerImpressionID-2');
1132
+ expect(data.s[1].ps[0].db).to.equal(0);
1133
+ expect(data.s[1].ps[0].kgpv).to.equal('this-is-a-kgpv');
1134
+ expect(data.s[1].ps[0].kgpsv).to.equal('this-is-a-kgpv');
1135
+ expect(data.s[1].ps[0].psz).to.equal('728x90');
1136
+ expect(data.s[1].ps[0].eg).to.equal(1.52);
1137
+ expect(data.s[1].ps[0].en).to.equal(1.52);
1138
+ expect(data.s[1].ps[0].di).to.equal('the-deal-id');
1139
+ expect(data.s[1].ps[0].dc).to.equal('PMP');
1140
+ expect(data.s[1].ps[0].mi).to.equal('matched-impression');
1141
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
1142
+ expect(data.s[1].ps[0].l1).to.equal(3214);
1143
+ expect(data.s[1].ps[0].l2).to.equal(0);
1144
+ expect(data.s[1].ps[0].ss).to.equal(1);
1145
+ expect(data.s[1].ps[0].t).to.equal(0);
1146
+ expect(data.s[1].ps[0].wb).to.equal(1);
1147
+ expect(data.s[1].ps[0].af).to.equal('banner');
1148
+ expect(data.s[1].ps[0].ocpm).to.equal(1.52);
1149
+ expect(data.s[1].ps[0].ocry).to.equal('USD');
1150
+
1151
+ // tracker slot1
1152
+ let firstTracker = requests[0].url;
1153
+ expect(firstTracker.split('?')[0]).to.equal('https://t.pubmatic.com/wt');
1154
+ data = {};
1155
+ firstTracker.split('?')[1].split('&').map(e => e.split('=')).forEach(e => data[e[0]] = e[1]);
1156
+ expect(data.pubid).to.equal('9999');
1157
+ expect(decodeURIComponent(data.purl)).to.equal('http://www.test.com/page.html');
1158
+ expect(data.tst).to.equal('1519767014');
1159
+ expect(data.iid).to.equal('25c6d7f5-699a-4bfc-87c9-996f915341fa');
1160
+ expect(data.bidid).to.equal('2ecff0db240757');
1161
+ expect(data.pid).to.equal('1111');
1162
+ expect(data.pdvid).to.equal('20');
1163
+ expect(decodeURIComponent(data.slot)).to.equal('/19968336/header-bid-tag-0');
1164
+ expect(decodeURIComponent(data.kgpv)).to.equal('/19968336/header-bid-tag-0');
1165
+ expect(data.pn).to.equal('pubmatic');
1166
+ expect(data.bc).to.equal('groupm');
1167
+ expect(data.eg).to.equal('1.23');
1168
+ expect(data.en).to.equal('1.23');
1169
+ expect(data.piid).to.equal('partnerImpressionID-1');
1170
+ });
1054
1171
  });
1055
1172
  });
@@ -1362,4 +1362,78 @@ describe('synacormediaBidAdapter ', function () {
1362
1362
  expect(videoRequest.data.imp[0].bidfloor).to.equal(priceModuleFloor);
1363
1363
  });
1364
1364
  });
1365
+
1366
+ describe('Bid Requests with gpid or anything in bid.ext should use if available', function () {
1367
+ let validVideoBidRequest = {
1368
+ bidder: 'synacormedia',
1369
+ params: {
1370
+ seatId: 'prebid',
1371
+ placementId: 'demo1',
1372
+ pos: 1,
1373
+ video: {}
1374
+ },
1375
+ renderer: {
1376
+ url: '../syncOutstreamPlayer.js'
1377
+ },
1378
+ ortb2Imp: {
1379
+ ext: {
1380
+ gpid: '/1111/homepage-video',
1381
+ data: {
1382
+ pbadslot: '/1111/homepage-video'
1383
+ }
1384
+ }
1385
+ },
1386
+ mediaTypes: {
1387
+ video: {
1388
+ playerSize: [[300, 250]],
1389
+ context: 'outstream'
1390
+ }
1391
+ },
1392
+ adUnitCode: 'div-1',
1393
+ transactionId: '0869f34e-090b-4b20-84ee-46ff41405a39',
1394
+ sizes: [[300, 250]],
1395
+ bidId: '22b3a2268d9f0e',
1396
+ bidderRequestId: '1d195910597e13',
1397
+ auctionId: '3375d336-2aea-4ee7-804c-6d26b621ad20',
1398
+ src: 'client',
1399
+ bidRequestsCount: 1,
1400
+ bidderRequestsCount: 1,
1401
+ bidderWinsCount: 0
1402
+ };
1403
+
1404
+ let validBannerBidRequest = {
1405
+ bidId: '9876abcd',
1406
+ sizes: [[300, 250]],
1407
+ params: {
1408
+ seatId: 'prebid',
1409
+ placementId: '1234',
1410
+ },
1411
+ ortb2Imp: {
1412
+ ext: {
1413
+ gpid: '/1111/homepage-banner',
1414
+ data: {
1415
+ pbadslot: '/1111/homepage-banner'
1416
+ }
1417
+ }
1418
+ }
1419
+ };
1420
+
1421
+ let bidderRequest = {
1422
+ refererInfo: {
1423
+ referer: 'http://localhost:9999/'
1424
+ },
1425
+ bidderCode: 'synacormedia',
1426
+ auctionId: 'f8a75621-d672-4cbb-9275-3db7d74fb110'
1427
+ };
1428
+
1429
+ it('should return valid gpid and pbadslot', function () {
1430
+ let videoRequest = spec.buildRequests([validVideoBidRequest], bidderRequest);
1431
+ let bannerRequest = spec.buildRequests([validBannerBidRequest], bidderRequest);
1432
+
1433
+ expect(videoRequest.data.imp[0].ext.gpid).to.equal('/1111/homepage-video');
1434
+ expect(videoRequest.data.imp[0].ext.data.pbadslot).to.equal('/1111/homepage-video');
1435
+ expect(bannerRequest.data.imp[0].ext.gpid).to.equal('/1111/homepage-banner');
1436
+ expect(bannerRequest.data.imp[0].ext.data.pbadslot).to.equal('/1111/homepage-banner');
1437
+ });
1438
+ });
1365
1439
  });
@@ -466,6 +466,7 @@ describe('User ID', function () {
466
466
  describe('refreshing before init is complete', () => {
467
467
  const MOCK_ID = {'MOCKID': '1111'};
468
468
  let mockIdCallback;
469
+ let startInit;
469
470
 
470
471
  beforeEach(() => {
471
472
  mockIdCallback = sinon.stub();
@@ -480,7 +481,7 @@ describe('User ID', function () {
480
481
  };
481
482
  init(config);
482
483
  setSubmoduleRegistry([mockIdSystem]);
483
- config.setConfig({
484
+ startInit = () => config.setConfig({
484
485
  userSync: {
485
486
  auctionDelay: 10,
486
487
  userIds: [{
@@ -492,6 +493,7 @@ describe('User ID', function () {
492
493
  });
493
494
 
494
495
  it('should still resolve promises returned by getUserIdsAsync', () => {
496
+ startInit();
495
497
  let result = null;
496
498
  getGlobal().getUserIdsAsync().then((val) => { result = val; });
497
499
  return clearStack().then(() => {
@@ -506,6 +508,7 @@ describe('User ID', function () {
506
508
  it('should not stop auctions', (done) => {
507
509
  // simulate an infinite `auctionDelay`; refreshing should still allow the auction to continue
508
510
  // as soon as ID submodules have completed init
511
+ startInit();
509
512
  requestBidsHook(() => {
510
513
  done();
511
514
  }, {adUnits: [getAdUnitMock()]}, {delay: delay()});
@@ -519,6 +522,7 @@ describe('User ID', function () {
519
522
  it('should not get stuck when init fails', () => {
520
523
  const err = new Error();
521
524
  mockIdCallback.callsFake(() => { throw err; });
525
+ startInit();
522
526
  return getGlobal().getUserIdsAsync().catch((e) =>
523
527
  expect(e).to.equal(err)
524
528
  );
@@ -1821,7 +1825,7 @@ describe('User ID', function () {
1821
1825
  }, {adUnits});
1822
1826
  });
1823
1827
 
1824
- it('test hook from merkleId cookies', function (done) {
1828
+ it('test hook from merkleId cookies - legacy', function (done) {
1825
1829
  // simulate existing browser local storage values
1826
1830
  coreStorage.setCookie('merkleId', JSON.stringify({'pam_id': {'id': 'testmerkleId', 'keyID': 1}}), (new Date(Date.now() + 5000).toUTCString()));
1827
1831
 
@@ -1845,6 +1849,32 @@ describe('User ID', function () {
1845
1849
  }, {adUnits});
1846
1850
  });
1847
1851
 
1852
+ it('test hook from merkleId cookies', function (done) {
1853
+ // simulate existing browser local storage values
1854
+ coreStorage.setCookie('merkleId', JSON.stringify({
1855
+ 'merkleId': [{id: 'testmerkleId', ext: { keyID: 1, ssp: 'ssp1' }}, {id: 'another-random-id-value', ext: { ssp: 'ssp2' }}],
1856
+ '_svsid': 'svs-id-1'
1857
+ }), (new Date(Date.now() + 5000).toUTCString()));
1858
+
1859
+ init(config);
1860
+ setSubmoduleRegistry([merkleIdSubmodule]);
1861
+ config.setConfig(getConfigMock(['merkleId', 'merkleId', 'cookie']));
1862
+
1863
+ requestBidsHook(function () {
1864
+ adUnits.forEach(unit => {
1865
+ unit.bids.forEach(bid => {
1866
+ expect(bid).to.have.deep.nested.property('userId.merkleId');
1867
+ expect(bid.userId.merkleId.length).to.equal(2);
1868
+ expect(bid.userIdAsEids.length).to.equal(2);
1869
+ expect(bid.userIdAsEids[0]).to.deep.equal({ source: 'ssp1.merkleinc.com', uids: [{id: 'testmerkleId', atype: 3, ext: { keyID: 1, ssp: 'ssp1' }}] });
1870
+ expect(bid.userIdAsEids[1]).to.deep.equal({ source: 'ssp2.merkleinc.com', uids: [{id: 'another-random-id-value', atype: 3, ext: { ssp: 'ssp2' }}] });
1871
+ });
1872
+ });
1873
+ coreStorage.setCookie('merkleId', '', EXPIRED_COOKIE_DATE);
1874
+ done();
1875
+ }, {adUnits});
1876
+ });
1877
+
1848
1878
  it('test hook from zeotapIdPlus cookies', function (done) {
1849
1879
  // simulate existing browser local storage values
1850
1880
  coreStorage.setCookie('IDP', btoa(JSON.stringify('abcdefghijk')), (new Date(Date.now() + 5000).toUTCString()));
@@ -2509,7 +2539,6 @@ describe('User ID', function () {
2509
2539
 
2510
2540
  // init id system
2511
2541
  attachIdSystem(mockIdSystem);
2512
- config.setConfig(userIdConfig);
2513
2542
  });
2514
2543
 
2515
2544
  afterEach(function () {
@@ -2520,6 +2549,8 @@ describe('User ID', function () {
2520
2549
  coreStorage.setCookie(mockIdCookieName, JSON.stringify({id: '1234'}), expStr);
2521
2550
  coreStorage.setCookie(`${mockIdCookieName}_last`, (new Date(Date.now() - 1 * 1000).toUTCString()), expStr);
2522
2551
 
2552
+ config.setConfig(userIdConfig);
2553
+
2523
2554
  let innerAdUnits;
2524
2555
  return runBidsHook((config) => {
2525
2556
  innerAdUnits = config.adUnits
@@ -2534,6 +2565,8 @@ describe('User ID', function () {
2534
2565
  coreStorage.setCookie(mockIdCookieName, JSON.stringify({id: '1234'}), expStr);
2535
2566
  coreStorage.setCookie(`${mockIdCookieName}_last`, (new Date(Date.now() - 60 * 1000).toUTCString()), expStr);
2536
2567
 
2568
+ config.setConfig(userIdConfig);
2569
+
2537
2570
  let innerAdUnits;
2538
2571
  return runBidsHook((config) => {
2539
2572
  innerAdUnits = config.adUnits
@@ -2550,6 +2583,8 @@ describe('User ID', function () {
2550
2583
 
2551
2584
  setStoredConsentData();
2552
2585
 
2586
+ config.setConfig(userIdConfig);
2587
+
2553
2588
  let innerAdUnits;
2554
2589
  return runBidsHook((config) => {
2555
2590
  innerAdUnits = config.adUnits
@@ -2566,6 +2601,8 @@ describe('User ID', function () {
2566
2601
 
2567
2602
  setStoredConsentData({...consentData, consentString: 'different'});
2568
2603
 
2604
+ config.setConfig(userIdConfig);
2605
+
2569
2606
  let innerAdUnits;
2570
2607
  return runBidsHook((config) => {
2571
2608
  innerAdUnits = config.adUnits
@@ -2582,6 +2619,8 @@ describe('User ID', function () {
2582
2619
 
2583
2620
  setStoredConsentData({...consentData});
2584
2621
 
2622
+ config.setConfig(userIdConfig);
2623
+
2585
2624
  let innerAdUnits;
2586
2625
  return runBidsHook((config) => {
2587
2626
  innerAdUnits = config.adUnits
@@ -322,7 +322,9 @@ describe('VidazooBidAdapter', function () {
322
322
  describe('unique deal id', function () {
323
323
  const key = 'myKey';
324
324
  let uniqueDealId;
325
- uniqueDealId = getUniqueDealId(key);
325
+ beforeEach(() => {
326
+ uniqueDealId = getUniqueDealId(key, 0);
327
+ })
326
328
 
327
329
  it('should get current unique deal id', function (done) {
328
330
  // waiting some time so `now` will become past
@@ -333,9 +335,12 @@ describe('VidazooBidAdapter', function () {
333
335
  }, 200);
334
336
  });
335
337
 
336
- it('should get new unique deal id on expiration', function () {
337
- const current = getUniqueDealId(key, 100);
338
- expect(current).to.not.be.equal(uniqueDealId);
338
+ it('should get new unique deal id on expiration', function (done) {
339
+ setTimeout(() => {
340
+ const current = getUniqueDealId(key, 100);
341
+ expect(current).to.not.be.equal(uniqueDealId);
342
+ done();
343
+ }, 200)
339
344
  });
340
345
  });
341
346
 
@@ -16,8 +16,7 @@ import * as auctionModule from 'src/auction.js';
16
16
  import { registerBidder } from 'src/adapters/bidderFactory.js';
17
17
  import { _sendAdToCreative } from 'src/secureCreatives.js';
18
18
  import {find} from 'src/polyfill.js';
19
- import {synchronizePromise} from '../../helpers/syncPromise.js';
20
- import 'src/prebid.js';
19
+ import * as pbjsModule from 'src/prebid.js';
21
20
  import {hook} from '../../../src/hook.js';
22
21
 
23
22
  var assert = require('chai').assert;
@@ -193,7 +192,7 @@ window.apntag = {
193
192
  }
194
193
 
195
194
  describe('Unit: Prebid Module', function () {
196
- let bidExpiryStub, promiseSandbox;
195
+ let bidExpiryStub
197
196
 
198
197
  before(() => {
199
198
  hook.ready();
@@ -201,14 +200,11 @@ describe('Unit: Prebid Module', function () {
201
200
  });
202
201
 
203
202
  beforeEach(function () {
204
- promiseSandbox = sinon.createSandbox();
205
- synchronizePromise(promiseSandbox);
206
203
  bidExpiryStub = sinon.stub(filters, 'isBidNotExpired').callsFake(() => true);
207
204
  configObj.setConfig({ useBidCache: true });
208
205
  });
209
206
 
210
207
  afterEach(function() {
211
- promiseSandbox.restore();
212
208
  $$PREBID_GLOBAL$$.adUnits = [];
213
209
  bidExpiryStub.restore();
214
210
  configObj.setConfig({ useBidCache: false });