prebid.js 9.53.1 → 9.53.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 (185) hide show
  1. package/dist/33acrossAnalyticsAdapter.js +1 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.js +1 -1
  4. package/dist/BTBidAdapter.js +1 -1
  5. package/dist/adagioAnalyticsAdapter.js +1 -1
  6. package/dist/adagioBidAdapter.js +1 -1
  7. package/dist/adagioUtils.js +1 -1
  8. package/dist/addefendBidAdapter.js +1 -1
  9. package/dist/adgenerationBidAdapter.js +1 -1
  10. package/dist/adlooxRtdProvider.js +1 -1
  11. package/dist/adqueryBidAdapter.js +1 -1
  12. package/dist/adrelevantisBidAdapter.js +1 -1
  13. package/dist/adstirBidAdapter.js +1 -1
  14. package/dist/adtrgtmeBidAdapter.js +1 -1
  15. package/dist/adxcgAnalyticsAdapter.js +1 -1
  16. package/dist/adxcgBidAdapter.js +1 -1
  17. package/dist/adyoulikeBidAdapter.js +1 -1
  18. package/dist/agmaAnalyticsAdapter.js +1 -1
  19. package/dist/ajaBidAdapter.js +1 -1
  20. package/dist/amxBidAdapter.js +1 -1
  21. package/dist/amxIdSystem.js +1 -1
  22. package/dist/aniviewBidAdapter.js +1 -1
  23. package/dist/appierAnalyticsAdapter.js +1 -1
  24. package/dist/appnexusBidAdapter.js +1 -1
  25. package/dist/asoBidAdapter.js +1 -1
  26. package/dist/axonixBidAdapter.js +1 -1
  27. package/dist/beopBidAdapter.js +1 -1
  28. package/dist/bidglassBidAdapter.js +1 -1
  29. package/dist/big-richmediaBidAdapter.js +1 -1
  30. package/dist/bitmediaBidAdapter.js +1 -1
  31. package/dist/bridBidAdapter.js +1 -1
  32. package/dist/bridgeuppBidAdapter.js +1 -1
  33. package/dist/bridgewellBidAdapter.js +1 -1
  34. package/dist/brightMountainMediaBidAdapter.js +1 -1
  35. package/dist/carodaBidAdapter.js +1 -1
  36. package/dist/chtnwBidAdapter.js +1 -1
  37. package/dist/chunk-core.js +1 -1
  38. package/dist/concertBidAdapter.js +1 -1
  39. package/dist/connectadBidAdapter.js +1 -1
  40. package/dist/consumableBidAdapter.js +1 -1
  41. package/dist/contxtfulBidAdapter.js +1 -1
  42. package/dist/conversantAnalyticsAdapter.js +1 -1
  43. package/dist/conversantBidAdapter.js +1 -1
  44. package/dist/craftBidAdapter.js +1 -1
  45. package/dist/criteoBidAdapter.js +1 -1
  46. package/dist/cwireBidAdapter.js +1 -1
  47. package/dist/dailymotionBidAdapter.js +1 -1
  48. package/dist/dependencies.json +6 -1
  49. package/dist/dspxBidAdapter.js +1 -1
  50. package/dist/dxkultureBidAdapter.js +1 -1
  51. package/dist/eplanningBidAdapter.js +1 -1
  52. package/dist/equativBidAdapter.js +1 -1
  53. package/dist/eskimiBidAdapter.js +1 -1
  54. package/dist/euidIdSystem.js +1 -1
  55. package/dist/exadsBidAdapter.js +1 -1
  56. package/dist/excoBidAdapter.js +1 -1
  57. package/dist/fanAdapter.js +1 -1
  58. package/dist/feedadBidAdapter.js +1 -1
  59. package/dist/finativeBidAdapter.js +1 -1
  60. package/dist/freewheel-sspBidAdapter.js +1 -1
  61. package/dist/gmosspBidAdapter.js +1 -1
  62. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  63. package/dist/greenbidsBidAdapter.js +1 -1
  64. package/dist/greenbidsRtdProvider.js +1 -1
  65. package/dist/gridBidAdapter.js +1 -1
  66. package/dist/gumgumBidAdapter.js +1 -1
  67. package/dist/h12mediaBidAdapter.js +1 -1
  68. package/dist/hypelabBidAdapter.js +1 -1
  69. package/dist/id5AnalyticsAdapter.js +1 -1
  70. package/dist/id5IdSystem.js +1 -1
  71. package/dist/imdsBidAdapter.js +1 -1
  72. package/dist/improvedigitalBidAdapter.js +1 -1
  73. package/dist/inmobiBidAdapter.js +1 -1
  74. package/dist/insticatorBidAdapter.js +1 -1
  75. package/dist/intentIqAnalyticsAdapter.js +1 -1
  76. package/dist/ixBidAdapter.js +1 -1
  77. package/dist/jixieBidAdapter.js +1 -1
  78. package/dist/justpremiumBidAdapter.js +1 -1
  79. package/dist/kargoBidAdapter.js +1 -1
  80. package/dist/kimberliteBidAdapter.js +1 -1
  81. package/dist/konduitAnalyticsAdapter.js +1 -1
  82. package/dist/kueezBidAdapter.js +1 -1
  83. package/dist/lassoBidAdapter.js +1 -1
  84. package/dist/lifestreetBidAdapter.js +1 -1
  85. package/dist/liveIntentId.js +1 -1
  86. package/dist/logicadBidAdapter.js +1 -1
  87. package/dist/loglyliftBidAdapter.js +1 -1
  88. package/dist/luceadBidAdapter.js +1 -1
  89. package/dist/mabidderBidAdapter.js +1 -1
  90. package/dist/madsenseBidAdapter.js +1 -1
  91. package/dist/magniteAnalyticsAdapter.js +1 -1
  92. package/dist/malltvAnalyticsAdapter.js +1 -1
  93. package/dist/marsmediaBidAdapter.js +1 -1
  94. package/dist/mediafuseBidAdapter.js +1 -1
  95. package/dist/medianetBidAdapter.js +1 -1
  96. package/dist/medianetUtils.js +1 -1
  97. package/dist/mediasquareBidAdapter.js +1 -1
  98. package/dist/mgidBidAdapter.js +1 -1
  99. package/dist/missenaBidAdapter.js +1 -1
  100. package/dist/mobilefuseBidAdapter.js +1 -1
  101. package/dist/nextMillenniumBidAdapter.js +1 -1
  102. package/dist/nexx360Utils.js +1 -1
  103. package/dist/nobidAnalyticsAdapter.js +1 -1
  104. package/dist/nobidBidAdapter.js +1 -1
  105. package/dist/nodalsAiRtdProvider.js +1 -1
  106. package/dist/not-for-prod/prebid.js +168 -168
  107. package/dist/oguryBidAdapter.js +1 -1
  108. package/dist/onetagBidAdapter.js +1 -1
  109. package/dist/ooloAnalyticsAdapter.js +1 -1
  110. package/dist/openxBidAdapter.js +1 -1
  111. package/dist/optidigitalBidAdapter.js +1 -1
  112. package/dist/orbidderBidAdapter.js +1 -1
  113. package/dist/outbrainBidAdapter.js +1 -1
  114. package/dist/pixfutureBidAdapter.js +1 -1
  115. package/dist/publinkIdSystem.js +1 -1
  116. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  117. package/dist/pubmaticBidAdapter.js +1 -1
  118. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  119. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  120. package/dist/pxyzBidAdapter.js +1 -1
  121. package/dist/quantcastBidAdapter.js +1 -1
  122. package/dist/readpeakBidAdapter.js +1 -1
  123. package/dist/relaidoBidAdapter.js +1 -1
  124. package/dist/retailspotBidAdapter.js +1 -1
  125. package/dist/rhythmoneBidAdapter.js +1 -1
  126. package/dist/riseUtils.js +1 -1
  127. package/dist/rubiconBidAdapter.js +1 -1
  128. package/dist/seedingAllianceBidAdapter.js +1 -1
  129. package/dist/seedtagBidAdapter.js +1 -1
  130. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  131. package/dist/sharethroughBidAdapter.js +1 -1
  132. package/dist/showheroes-bsBidAdapter.js +1 -1
  133. package/dist/smaatoBidAdapter.js +1 -1
  134. package/dist/smartadserverBidAdapter.js +1 -1
  135. package/dist/smartxBidAdapter.js +1 -1
  136. package/dist/smilewantedBidAdapter.js +1 -1
  137. package/dist/snigelBidAdapter.js +1 -1
  138. package/dist/sonobiBidAdapter.js +1 -1
  139. package/dist/sovrnBidAdapter.js +1 -1
  140. package/dist/sparteoBidAdapter.js +1 -1
  141. package/dist/sspBCBidAdapter.js +1 -1
  142. package/dist/stvBidAdapter.js +1 -1
  143. package/dist/sublimeBidAdapter.js +1 -1
  144. package/dist/taboolaBidAdapter.js +1 -1
  145. package/dist/tappxBidAdapter.js +1 -1
  146. package/dist/targetVideoBidAdapter.js +1 -1
  147. package/dist/teadsBidAdapter.js +1 -1
  148. package/dist/terceptAnalyticsAdapter.js +1 -1
  149. package/dist/themoneytizerBidAdapter.js +1 -1
  150. package/dist/trionBidAdapter.js +1 -1
  151. package/dist/tripleliftBidAdapter.js +1 -1
  152. package/dist/ttdBidAdapter.js +1 -1
  153. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  154. package/dist/uid2IdSystem.js +1 -1
  155. package/dist/underdogmediaBidAdapter.js +1 -1
  156. package/dist/undertoneBidAdapter.js +1 -1
  157. package/dist/unrulyBidAdapter.js +1 -1
  158. package/dist/userId.js +1 -1
  159. package/dist/vidazooUtils.js +1 -1
  160. package/dist/videobyteBidAdapter.js +1 -1
  161. package/dist/visxBidAdapter.js +1 -1
  162. package/dist/vuukleBidAdapter.js +1 -1
  163. package/dist/widespaceBidAdapter.js +1 -1
  164. package/dist/winrBidAdapter.js +1 -1
  165. package/dist/yahooAdsBidAdapter.js +1 -1
  166. package/dist/yandexBidAdapter.js +1 -1
  167. package/dist/yieldmoBidAdapter.js +1 -1
  168. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  169. package/libraries/liveIntentId/shared.js +16 -0
  170. package/modules/fanAdapter.js +318 -124
  171. package/modules/userId/index.js +30 -31
  172. package/package.json +4 -4
  173. package/test/spec/modules/euidIdSystem_spec.js +9 -3
  174. package/test/spec/modules/fanAdapter_spec.js +264 -268
  175. package/test/spec/modules/id5IdSystem_spec.js +57 -101
  176. package/test/spec/modules/idxIdSystem_spec.js +2 -75
  177. package/test/spec/modules/liveIntentExternalIdSystem_spec.js +5 -0
  178. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +5 -0
  179. package/test/spec/modules/liveIntentIdSystem_spec.js +38 -0
  180. package/test/spec/modules/lmpIdSystem_spec.js +2 -81
  181. package/test/spec/modules/pubmaticBidAdapter_spec.js +411 -126
  182. package/test/spec/modules/sharedIdSystem_spec.js +3 -3
  183. package/test/spec/modules/uid2IdSystem_helpers.js +5 -2
  184. package/test/spec/modules/userId_spec.js +142 -387
  185. package/test/spec/modules/zeotapIdPlusIdSystem_spec.js +3 -69
@@ -8,7 +8,6 @@ import {
8
8
  init,
9
9
  PBJS_USER_ID_OPTOUT_NAME,
10
10
  startAuctionHook,
11
- addUserIdsHook,
12
11
  requestDataDeletion,
13
12
  setStoredValue,
14
13
  setSubmoduleRegistry,
@@ -177,7 +176,6 @@ describe('User ID', function () {
177
176
  sandbox.restore();
178
177
  config.resetConfig();
179
178
  startAuction.getHooks({hook: startAuctionHook}).remove();
180
- startAuction.getHooks({hook: addUserIdsHook}).remove();
181
179
  });
182
180
 
183
181
  after(() => {
@@ -281,12 +279,12 @@ describe('User ID', function () {
281
279
  coreStorage.setCookie('pubcid_alt', '', EXPIRED_COOKIE_DATE);
282
280
  });
283
281
 
284
- it('Check same cookie behavior', function () {
285
- let adUnits1 = [getAdUnitMock()];
286
- let adUnits2 = [getAdUnitMock()];
287
- let innerAdUnits1;
288
- let innerAdUnits2;
282
+ function getGlobalEids() {
283
+ const ortb2Fragments = {global: {}};
284
+ return expectImmediateBidHook(sinon.stub(), {ortb2Fragments}).then(() => ortb2Fragments.global.user?.ext?.eids);
285
+ }
289
286
 
287
+ it('Check same cookie behavior', async function () {
290
288
  let pubcid = coreStorage.getCookie('pubcid');
291
289
  expect(pubcid).to.be.null; // there should be no cookie initially
292
290
 
@@ -294,36 +292,19 @@ describe('User ID', function () {
294
292
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
295
293
 
296
294
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie']));
297
-
298
- return expectImmediateBidHook(config => {
299
- innerAdUnits1 = config.adUnits
300
- }, {adUnits: adUnits1}).then(() => {
301
- pubcid = coreStorage.getCookie('pubcid'); // cookies is created after requestbidHook
302
-
303
- innerAdUnits1.forEach(unit => {
304
- unit.bids.forEach(bid => {
305
- expect(bid).to.have.deep.nested.property('userId.pubcid');
306
- expect(bid.userId.pubcid).to.equal(pubcid);
307
- expect(bid.userIdAsEids[0]).to.deep.equal({
308
- source: 'pubcid.org',
309
- uids: [{id: pubcid, atype: 1}]
310
- });
311
- });
312
- });
313
-
314
- return expectImmediateBidHook(config => {
315
- innerAdUnits2 = config.adUnits
316
- }, {adUnits: adUnits2}).then(() => {
317
- assert.deepEqual(innerAdUnits1, innerAdUnits2);
318
- });
319
- });
295
+ const eids1 = await getGlobalEids();
296
+ pubcid = coreStorage.getCookie('pubcid'); // cookies is created after requestbidHook
297
+ expect(eids1).to.eql([
298
+ {
299
+ source: 'pubcid.org',
300
+ uids: [{id: pubcid, atype: 1}]
301
+ }
302
+ ])
303
+ const eids2 = await getGlobalEids();
304
+ assert.deepEqual(eids1, eids2);
320
305
  });
321
306
 
322
- it('Check different cookies', function () {
323
- let adUnits1 = [getAdUnitMock()];
324
- let adUnits2 = [getAdUnitMock()];
325
- let innerAdUnits1;
326
- let innerAdUnits2;
307
+ it('Check different cookies', async function () {
327
308
  let pubcid1;
328
309
  let pubcid2;
329
310
 
@@ -331,75 +312,41 @@ describe('User ID', function () {
331
312
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
332
313
 
333
314
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie']));
334
- return expectImmediateBidHook((config) => {
335
- innerAdUnits1 = config.adUnits
336
- }, {adUnits: adUnits1}).then(() => {
337
- pubcid1 = coreStorage.getCookie('pubcid'); // get first cookie
338
- coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE); // erase cookie
339
-
340
- innerAdUnits1.forEach((unit) => {
341
- unit.bids.forEach((bid) => {
342
- expect(bid).to.have.deep.nested.property('userId.pubcid');
343
- expect(bid.userId.pubcid).to.equal(pubcid1);
344
- expect(bid.userIdAsEids[0]).to.deep.equal({
345
- source: 'pubcid.org',
346
- uids: [{id: pubcid1, atype: 1}]
347
- });
348
- });
349
- });
350
315
 
351
- init(config);
352
- setSubmoduleRegistry([sharedIdSystemSubmodule]);
316
+ const eids1 = await getGlobalEids()
317
+ pubcid1 = coreStorage.getCookie('pubcid'); // get first cookie
318
+ coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE); // erase cookie
319
+ expect(eids1).to.eql([{
320
+ source: 'pubcid.org',
321
+ uids: [{id: pubcid1, atype: 1}]
322
+ }])
353
323
 
354
- config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie']));
355
- return expectImmediateBidHook((config) => {
356
- innerAdUnits2 = config.adUnits
357
- }, {adUnits: adUnits2}).then(() => {
358
- pubcid2 = coreStorage.getCookie('pubcid'); // get second cookie
359
-
360
- innerAdUnits2.forEach((unit) => {
361
- unit.bids.forEach((bid) => {
362
- expect(bid).to.have.deep.nested.property('userId.pubcid');
363
- expect(bid.userId.pubcid).to.equal(pubcid2);
364
- expect(bid.userIdAsEids[0]).to.deep.equal({
365
- source: 'pubcid.org',
366
- uids: [{id: pubcid2, atype: 1}]
367
- });
368
- });
369
- });
324
+ init(config);
325
+ setSubmoduleRegistry([sharedIdSystemSubmodule]);
326
+ config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie']));
370
327
 
371
- expect(pubcid1).to.not.equal(pubcid2);
372
- });
373
- });
328
+ const eids2 = await getGlobalEids();
329
+ pubcid2 = coreStorage.getCookie('pubcid'); // get second cookie
330
+ expect(eids2).to.eql([{
331
+ source: 'pubcid.org',
332
+ uids: [{id: pubcid2, atype: 1}]
333
+ }])
334
+ expect(pubcid1).to.not.equal(pubcid2);
374
335
  });
375
336
 
376
- it('Use existing cookie', function () {
377
- let adUnits = [getAdUnitMock()];
378
- let innerAdUnits;
379
-
337
+ it('Use existing cookie', async function () {
380
338
  init(config);
381
339
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
382
340
 
383
341
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid_alt', 'cookie']));
384
- return expectImmediateBidHook((config) => {
385
- innerAdUnits = config.adUnits
386
- }, {adUnits}).then(() => {
387
- innerAdUnits.forEach((unit) => {
388
- unit.bids.forEach((bid) => {
389
- expect(bid).to.have.deep.nested.property('userId.pubcid');
390
- expect(bid.userId.pubcid).to.equal('altpubcid200000');
391
- expect(bid.userIdAsEids[0]).to.deep.equal({
392
- source: 'pubcid.org',
393
- uids: [{id: 'altpubcid200000', atype: 1}]
394
- });
395
- });
396
- });
397
- });
342
+ const eids = await getGlobalEids();
343
+ expect(eids).to.eql([{
344
+ source: 'pubcid.org',
345
+ uids: [{id: 'altpubcid200000', atype: 1}]
346
+ }])
398
347
  });
399
348
 
400
- it('Extend cookie', function () {
401
- let adUnits = [getAdUnitMock()];
402
- let innerAdUnits;
349
+ it('Extend cookie', async function () {
403
350
  let customConfig = getConfigMock(['pubCommonId', 'pubcid_alt', 'cookie']);
404
351
  customConfig = addConfig(customConfig, 'params', {extend: true});
405
352
 
@@ -407,25 +354,15 @@ describe('User ID', function () {
407
354
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
408
355
 
409
356
  config.setConfig(customConfig);
410
- return expectImmediateBidHook((config) => {
411
- innerAdUnits = config.adUnits
412
- }, {adUnits}).then(() => {
413
- innerAdUnits.forEach((unit) => {
414
- unit.bids.forEach((bid) => {
415
- expect(bid).to.have.deep.nested.property('userId.pubcid');
416
- expect(bid.userId.pubcid).to.equal('altpubcid200000');
417
- expect(bid.userIdAsEids[0]).to.deep.equal({
418
- source: 'pubcid.org',
419
- uids: [{id: 'altpubcid200000', atype: 1}]
420
- });
421
- });
422
- });
423
- });
357
+ const fpd = {};
358
+ const eids = await getGlobalEids();
359
+ expect(eids).to.deep.equal([{
360
+ source: 'pubcid.org',
361
+ uids: [{id: 'altpubcid200000', atype: 1}]
362
+ }]);
424
363
  });
425
364
 
426
- it('Disable auto create', function () {
427
- let adUnits = [getAdUnitMock()];
428
- let innerAdUnits;
365
+ it('Disable auto create', async function () {
429
366
  let customConfig = getConfigMock(['pubCommonId', 'pubcid', 'cookie']);
430
367
  customConfig = addConfig(customConfig, 'params', {create: false});
431
368
 
@@ -433,16 +370,8 @@ describe('User ID', function () {
433
370
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
434
371
 
435
372
  config.setConfig(customConfig);
436
- return expectImmediateBidHook((config) => {
437
- innerAdUnits = config.adUnits
438
- }, {adUnits}).then(() => {
439
- innerAdUnits.forEach((unit) => {
440
- unit.bids.forEach((bid) => {
441
- expect(bid).to.not.have.deep.nested.property('userId.pubcid');
442
- expect(bid).to.not.have.deep.nested.property('userIdAsEids');
443
- });
444
- });
445
- });
373
+ const eids = await getGlobalEids();
374
+ expect(eids).to.not.exist;
446
375
  });
447
376
 
448
377
  describe('createEidsArray', () => {
@@ -1744,8 +1673,6 @@ describe('User ID', function () {
1744
1673
  // check ids were copied to bids
1745
1674
  adUnits.forEach(unit => {
1746
1675
  unit.bids.forEach(bid => {
1747
- expect(bid).to.have.deep.nested.property('userId.mid');
1748
- expect(bid.userId.mid).to.equal('1234');
1749
1676
  expect(bid.userIdAsEids).to.not.exist;// "mid" is an un-known submodule for USER_IDS_CONFIG in eids.js
1750
1677
  });
1751
1678
  });
@@ -1840,70 +1767,39 @@ describe('User ID', function () {
1840
1767
  });
1841
1768
  });
1842
1769
 
1843
- describe('Start auction hook appends userId to bid objs in adapters', function () {
1770
+ describe('Start auction hook appends userId to first party data', function () {
1844
1771
  let adUnits;
1845
1772
 
1846
1773
  beforeEach(function () {
1847
1774
  adUnits = [getAdUnitMock()];
1848
1775
  });
1849
1776
 
1850
- it('should include pub-provided eids in userIdAsEids', (done) => {
1851
- init(config);
1852
- setSubmoduleRegistry([createMockIdSubmodule('mockId', {id: {mockId: 'id'}}, null, {mockId: {source: 'mockid.com', atype: 1}})]);
1853
- config.setConfig({
1854
- userSync: {
1855
- userIds: [
1856
- {name: 'mockId'}
1857
- ]
1858
- }
1859
- });
1860
- startAuctionHook(({adUnits}) => {
1861
- adUnits[0].bids.forEach(bid => {
1862
- expect(bid.userIdAsEids.find(eid => eid.source === 'mockid.com')).to.exist;
1863
- const bidderEid = bid.userIdAsEids.find(eid => eid.bidder === 'pub-provided');
1864
- expect(bidderEid != null).to.eql(bid.bidder === 'sampleBidder');
1865
- expect(bid.userIdAsEids.find(eid => eid.id === 'pub-provided')).to.exist;
1866
- })
1867
- done();
1868
- }, {
1869
- adUnits,
1870
- ortb2Fragments: {
1871
- global: {
1872
- user: {ext: {eids: [{id: 'pub-provided'}]}}
1873
- },
1874
- bidder: {
1875
- sampleBidder: {
1876
- user: {ext: {eids: [{bidder: 'pub-provided'}]}}
1877
- }
1878
- }
1879
- }
1777
+ function getGlobalEids() {
1778
+ return new Promise((resolve) => {
1779
+ startAuctionHook(function ({ortb2Fragments}) {
1780
+ resolve(ortb2Fragments.global.user?.ext?.eids);
1781
+ }, {ortb2Fragments: { global: {} }})
1880
1782
  })
1881
- })
1783
+ }
1882
1784
 
1883
- it('test hook from pubcommonid cookie', function (done) {
1785
+ it('test hook from pubcommonid cookie', async function () {
1884
1786
  coreStorage.setCookie('pubcid', 'testpubcid', (new Date(Date.now() + 100000).toUTCString()));
1885
1787
 
1886
1788
  init(config);
1887
1789
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
1888
1790
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie']));
1889
-
1890
- startAuctionHook(function () {
1891
- adUnits.forEach(unit => {
1892
- unit.bids.forEach(bid => {
1893
- expect(bid).to.have.deep.nested.property('userId.pubcid');
1894
- expect(bid.userId.pubcid).to.equal('testpubcid');
1895
- expect(bid.userIdAsEids[0]).to.deep.equal({
1896
- source: 'pubcid.org',
1897
- uids: [{id: 'testpubcid', atype: 1}]
1898
- });
1899
- });
1900
- });
1791
+ try {
1792
+ const eids = await getGlobalEids();
1793
+ expect(eids).to.eql([{
1794
+ source: 'pubcid.org',
1795
+ uids: [{id: 'testpubcid', atype: 1}]
1796
+ }])
1797
+ } finally {
1901
1798
  coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE);
1902
- done();
1903
- }, {adUnits});
1799
+ }
1904
1800
  });
1905
1801
 
1906
- it('test hook from pubcommonid html5', function (done) {
1802
+ it('test hook from pubcommonid html5', async function () {
1907
1803
  // simulate existing browser local storage values
1908
1804
  localStorage.setItem('pubcid', 'testpubcid');
1909
1805
  localStorage.setItem('pubcid_exp', new Date(Date.now() + 100000).toUTCString());
@@ -1912,24 +1808,19 @@ describe('User ID', function () {
1912
1808
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
1913
1809
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'html5']));
1914
1810
 
1915
- startAuctionHook(function () {
1916
- adUnits.forEach(unit => {
1917
- unit.bids.forEach(bid => {
1918
- expect(bid).to.have.deep.nested.property('userId.pubcid');
1919
- expect(bid.userId.pubcid).to.equal('testpubcid');
1920
- expect(bid.userIdAsEids[0]).to.deep.equal({
1921
- source: 'pubcid.org',
1922
- uids: [{id: 'testpubcid', atype: 1}]
1923
- });
1924
- });
1925
- });
1811
+ try {
1812
+ const eids = await getGlobalEids();
1813
+ expect(eids).to.eql([{
1814
+ source: 'pubcid.org',
1815
+ uids: [{id: 'testpubcid', atype: 1}]
1816
+ }]);
1817
+ } finally {
1926
1818
  localStorage.removeItem('pubcid');
1927
1819
  localStorage.removeItem('pubcid_exp');
1928
- done();
1929
- }, {adUnits});
1820
+ }
1930
1821
  });
1931
1822
 
1932
- it('test hook from pubcommonid cookie&html5', function (done) {
1823
+ it('test hook from pubcommonid cookie&html5', async function () {
1933
1824
  const expiration = new Date(Date.now() + 100000).toUTCString();
1934
1825
  coreStorage.setCookie('pubcid', 'testpubcid', expiration);
1935
1826
  localStorage.setItem('pubcid', 'testpubcid');
@@ -1939,27 +1830,20 @@ describe('User ID', function () {
1939
1830
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
1940
1831
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie&html5']));
1941
1832
 
1942
- startAuctionHook(function () {
1943
- adUnits.forEach(unit => {
1944
- unit.bids.forEach(bid => {
1945
- expect(bid).to.have.deep.nested.property('userId.pubcid');
1946
- expect(bid.userId.pubcid).to.equal('testpubcid');
1947
- expect(bid.userIdAsEids[0]).to.deep.equal({
1948
- source: 'pubcid.org',
1949
- uids: [{id: 'testpubcid', atype: 1}]
1950
- });
1951
- });
1952
- });
1953
-
1833
+ try {
1834
+ const eids = await getGlobalEids();
1835
+ expect(eids).to.eql([{
1836
+ source: 'pubcid.org',
1837
+ uids: [{id: 'testpubcid', atype: 1}]
1838
+ }]);
1839
+ } finally {
1954
1840
  coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE);
1955
1841
  localStorage.removeItem('pubcid');
1956
1842
  localStorage.removeItem('pubcid_exp');
1957
-
1958
- done();
1959
- }, {adUnits});
1843
+ }
1960
1844
  });
1961
1845
 
1962
- it('test hook from pubcommonid cookie&html5, no cookie present', function (done) {
1846
+ it('test hook from pubcommonid cookie&html5, no cookie present', async function () {
1963
1847
  localStorage.setItem('pubcid', 'testpubcid');
1964
1848
  localStorage.setItem('pubcid_exp', new Date(Date.now() + 100000).toUTCString());
1965
1849
 
@@ -1967,68 +1851,44 @@ describe('User ID', function () {
1967
1851
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
1968
1852
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie&html5']));
1969
1853
 
1970
- startAuctionHook(function () {
1971
- adUnits.forEach(unit => {
1972
- unit.bids.forEach(bid => {
1973
- expect(bid).to.have.deep.nested.property('userId.pubcid');
1974
- expect(bid.userId.pubcid).to.equal('testpubcid');
1975
- expect(bid.userIdAsEids[0]).to.deep.equal({
1976
- source: 'pubcid.org',
1977
- uids: [{id: 'testpubcid', atype: 1}]
1978
- });
1979
- });
1980
- });
1981
-
1854
+ try {
1855
+ const eids = await getGlobalEids();
1856
+ expect(eids).to.eql([{
1857
+ source: 'pubcid.org',
1858
+ uids: [{id: 'testpubcid', atype: 1}]
1859
+ }])
1860
+ } finally {
1982
1861
  localStorage.removeItem('pubcid');
1983
1862
  localStorage.removeItem('pubcid_exp');
1984
-
1985
- done();
1986
- }, {adUnits});
1863
+ }
1987
1864
  });
1988
1865
 
1989
- it('test hook from pubcommonid cookie&html5, no local storage entry', function (done) {
1866
+ it('test hook from pubcommonid cookie&html5, no local storage entry', async function () {
1990
1867
  coreStorage.setCookie('pubcid', 'testpubcid', (new Date(Date.now() + 100000).toUTCString()));
1991
1868
 
1992
1869
  init(config);
1993
1870
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
1994
1871
  config.setConfig(getConfigMock(['pubCommonId', 'pubcid', 'cookie&html5']));
1995
1872
 
1996
- startAuctionHook(function () {
1997
- adUnits.forEach(unit => {
1998
- unit.bids.forEach(bid => {
1999
- expect(bid).to.have.deep.nested.property('userId.pubcid');
2000
- expect(bid.userId.pubcid).to.equal('testpubcid');
2001
- expect(bid.userIdAsEids[0]).to.deep.equal({
2002
- source: 'pubcid.org',
2003
- uids: [{id: 'testpubcid', atype: 1}]
2004
- });
2005
- });
2006
- });
2007
-
1873
+ try {
1874
+ const eids = await getGlobalEids();
1875
+ expect(eids).to.eql([{
1876
+ source: 'pubcid.org',
1877
+ uids: [{id: 'testpubcid', atype: 1}]
1878
+ }]);
1879
+ } finally {
2008
1880
  coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE);
2009
-
2010
- done();
2011
- }, {adUnits});
1881
+ }
2012
1882
  });
2013
1883
 
2014
- it('test hook from pubcommonid config value object', function (done) {
1884
+ it('test hook from pubcommonid config value object', async function () {
2015
1885
  init(config);
2016
1886
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
2017
1887
  config.setConfig(getConfigValueMock('pubCommonId', {'pubcidvalue': 'testpubcidvalue'}));
2018
-
2019
- startAuctionHook(function () {
2020
- adUnits.forEach(unit => {
2021
- unit.bids.forEach(bid => {
2022
- expect(bid).to.have.deep.nested.property('userId.pubcidvalue');
2023
- expect(bid.userId.pubcidvalue).to.equal('testpubcidvalue');
2024
- expect(bid.userIdAsEids).to.not.exist; // "pubcidvalue" is an un-known submodule for USER_IDS_CONFIG in eids.js
2025
- });
2026
- });
2027
- done();
2028
- }, {adUnits});
1888
+ expect(await getGlobalEids()).to.not.exist; // "pubcidvalue" is an un-known submodule for USER_IDS_CONFIG in eids.js
2029
1889
  });
2030
1890
 
2031
- it('test hook from pubProvidedId config params', function (done) {
1891
+ it('test hook from pubProvidedId config params', async function () {
2032
1892
  init(config);
2033
1893
  setSubmoduleRegistry([pubProvidedIdSubmodule]);
2034
1894
  config.setConfig({
@@ -2071,61 +1931,28 @@ describe('User ID', function () {
2071
1931
  }
2072
1932
  });
2073
1933
 
2074
- startAuctionHook(function () {
2075
- adUnits.forEach(unit => {
2076
- unit.bids.forEach(bid => {
2077
- expect(bid).to.have.deep.nested.property('userId.pubProvidedId');
2078
- expect(bid.userId.pubProvidedId).to.deep.equal([{
2079
- source: 'example.com',
2080
- uids: [{
2081
- id: 'value read from cookie or local storage',
2082
- ext: {
2083
- stype: 'ppuid'
2084
- }
2085
- }]
2086
- }, {
2087
- source: 'id-partner.com',
2088
- uids: [{
2089
- id: 'value read from cookie or local storage',
2090
- ext: {
2091
- stype: 'dmp'
2092
- }
2093
- }]
2094
- }, {
2095
- source: 'provider.com',
2096
- uids: [{
2097
- id: 'value read from cookie or local storage',
2098
- ext: {
2099
- stype: 'sha256email'
2100
- }
2101
- }]
2102
- }]);
2103
-
2104
- expect(bid.userIdAsEids[0]).to.deep.equal({
2105
- source: 'example.com',
2106
- uids: [{
2107
- id: 'value read from cookie or local storage',
2108
- ext: {
2109
- stype: 'ppuid'
2110
- }
2111
- }]
2112
- });
2113
- expect(bid.userIdAsEids[2]).to.deep.equal({
2114
- source: 'provider.com',
2115
- uids: [{
2116
- id: 'value read from cookie or local storage',
2117
- ext: {
2118
- stype: 'sha256email'
2119
- }
2120
- }]
2121
- });
2122
- });
2123
- });
2124
- done();
2125
- }, {adUnits});
1934
+ const eids = await getGlobalEids();
1935
+ expect(eids).to.deep.contain({
1936
+ source: 'example.com',
1937
+ uids: [{
1938
+ id: 'value read from cookie or local storage',
1939
+ ext: {
1940
+ stype: 'ppuid'
1941
+ }
1942
+ }]
1943
+ });
1944
+ expect(eids).to.deep.contain({
1945
+ source: 'provider.com',
1946
+ uids: [{
1947
+ id: 'value read from cookie or local storage',
1948
+ ext: {
1949
+ stype: 'sha256email'
1950
+ }
1951
+ }]
1952
+ });
2126
1953
  });
2127
1954
 
2128
- it('should add new id system ', function (done) {
1955
+ it('should add new id system ', async function () {
2129
1956
  coreStorage.setCookie('pubcid', 'testpubcid', (new Date(Date.now() + 5000).toUTCString()));
2130
1957
 
2131
1958
  init(config);
@@ -2153,23 +1980,16 @@ describe('User ID', function () {
2153
1980
  getId: function (config, consentData, storedId) {
2154
1981
  if (storedId) return {};
2155
1982
  return {id: {'MOCKID': '1234'}};
1983
+ },
1984
+ eids: {
1985
+ mid: {
1986
+ source: 'mockid'
1987
+ }
2156
1988
  }
2157
1989
  });
2158
1990
 
2159
- startAuctionHook(function () {
2160
- adUnits.forEach(unit => {
2161
- unit.bids.forEach(bid => {
2162
- // check PubCommonId id data was copied to bid
2163
- expect(bid).to.have.deep.nested.property('userId.pubcid');
2164
- // check MockId data was copied to bid
2165
- expect(bid).to.have.deep.nested.property('userId.mid');
2166
- expect(bid.userId.mid).to.equal('1234');
2167
- });
2168
- });
2169
- coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE);
2170
- coreStorage.setCookie('MOCKID', '', EXPIRED_COOKIE_DATE);
2171
- done();
2172
- }, {adUnits});
1991
+ const eids = await getGlobalEids();
1992
+ expect(eids.find(eid => eid.source === 'mockid')).to.exist;
2173
1993
  });
2174
1994
 
2175
1995
  describe('activity controls', () => {
@@ -2188,6 +2008,11 @@ describe('User ID', function () {
2188
2008
  },
2189
2009
  getId: function () {
2190
2010
  return {id: `${name}Value`};
2011
+ },
2012
+ eids: {
2013
+ [name]: {
2014
+ source: name
2015
+ }
2191
2016
  }
2192
2017
  }));
2193
2018
  mods.forEach(attachIdSystem);
@@ -2196,7 +2021,7 @@ describe('User ID', function () {
2196
2021
  isAllowed.restore();
2197
2022
  });
2198
2023
 
2199
- it('should check for enrichEids activity permissions', (done) => {
2024
+ it('should check for enrichEids activity permissions', async () => {
2200
2025
  isAllowed.callsFake((activity, params) => {
2201
2026
  return !(activity === ACTIVITY_ENRICH_EIDS &&
2202
2027
  params[ACTIVITY_PARAM_COMPONENT_TYPE] === MODULE_TYPE_UID &&
@@ -2211,11 +2036,9 @@ describe('User ID', function () {
2211
2036
  }))
2212
2037
  }
2213
2038
  });
2214
- startAuctionHook((req) => {
2215
- const activeIds = req.adUnits.flatMap(au => au.bids).flatMap(bid => Object.keys(bid.userId));
2216
- expect(Array.from(new Set(activeIds))).to.have.members([MOCK_IDS[1]]);
2217
- done();
2218
- }, {adUnits})
2039
+ const eids = await getGlobalEids();
2040
+ const activeSources = eids.map(({source}) => source);
2041
+ expect(Array.from(new Set(activeSources))).to.have.members([MOCK_IDS[1]]);
2219
2042
  });
2220
2043
  })
2221
2044
  });
@@ -2253,7 +2076,7 @@ describe('User ID', function () {
2253
2076
  init(config);
2254
2077
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
2255
2078
  config.mergeConfig(customCfg);
2256
- return runBidsHook({}).then(() => {
2079
+ return runBidsHook(sinon.stub(), {}).then(() => {
2257
2080
  expect(utils.triggerPixel.called).to.be.false;
2258
2081
  return endAuction();
2259
2082
  }).then(() => {
@@ -2528,62 +2351,6 @@ describe('User ID', function () {
2528
2351
  })
2529
2352
  })
2530
2353
  });
2531
-
2532
- describe('submodules not added', () => {
2533
- const eid = {
2534
- source: 'example.com',
2535
- uids: [{id: '1234', atype: 3}]
2536
- };
2537
- let adUnits;
2538
- let startAuctionStub;
2539
- function saHook(fn, ...args) {
2540
- return startAuctionStub(...args);
2541
- }
2542
- beforeEach(() => {
2543
- adUnits = [{code: 'au1', bids: [{bidder: 'sampleBidder'}]}];
2544
- startAuctionStub = sinon.stub();
2545
- startAuction.before(saHook);
2546
- config.resetConfig();
2547
- });
2548
- afterEach(() => {
2549
- startAuction.getHooks({hook: saHook}).remove();
2550
- })
2551
-
2552
- it('addUserIdsHook', function (done) {
2553
- addUserIdsHook(function () {
2554
- adUnits.forEach(unit => {
2555
- unit.bids.forEach(bid => {
2556
- expect(bid).to.have.deep.nested.property('userIdAsEids.0.source');
2557
- expect(bid).to.have.deep.nested.property('userIdAsEids.0.uids.0.id');
2558
- expect(bid.userIdAsEids[0].source).to.equal('example.com');
2559
- expect(bid.userIdAsEids[0].uids[0].id).to.equal('1234');
2560
- });
2561
- });
2562
- done();
2563
- }, {
2564
- adUnits,
2565
- ortb2Fragments: {
2566
- global: {user: {ext: {eids: [eid]}}},
2567
- bidder: {}
2568
- }
2569
- });
2570
- });
2571
-
2572
- it('should add userIdAsEids and merge ortb2.user.ext.eids even if no User ID submodules', async () => {
2573
- init(config);
2574
- expect(startAuction.getHooks({hook: startAuctionHook}).length).equal(0);
2575
- expect(startAuction.getHooks({hook: addUserIdsHook}).length).equal(1);
2576
- addUserIdsHook(sinon.stub(), {
2577
- adUnits,
2578
- ortb2Fragments: {
2579
- global: {
2580
- user: {ext: {eids: [eid]}}
2581
- }
2582
- }
2583
- });
2584
- expect(adUnits[0].bids[0].userIdAsEids[0]).to.eql(eid);
2585
- });
2586
- });
2587
2354
  });
2588
2355
 
2589
2356
  describe('handles config with ESP configuration in user sync object', function() {
@@ -3184,12 +2951,6 @@ describe('User ID', function () {
3184
2951
  });
3185
2952
 
3186
2953
  return getGlobal().getUserIdsAsync().then(() => {
3187
- const adUnits = [{
3188
- bids: [
3189
- { bidder: 'bidderA' },
3190
- { bidder: 'bidderB' },
3191
- ]
3192
- }];
3193
2954
  const ortb2Fragments = {
3194
2955
  global: {
3195
2956
  user: {}
@@ -3203,13 +2964,7 @@ describe('User ID', function () {
3203
2964
  }
3204
2965
  }
3205
2966
  };
3206
- addIdData({ adUnits, ortb2Fragments });
3207
-
3208
- adUnits[0].bids.forEach(({userId}) => {
3209
- const userIdModules = Object.keys(userId);
3210
- expect(userIdModules).to.include(ALLOWED_MODULE);
3211
- expect(userIdModules).to.not.include(UNALLOWED_MODULE);
3212
- });
2967
+ addIdData({ ortb2Fragments });
3213
2968
 
3214
2969
  bidders.forEach((bidderName) => {
3215
2970
  const userIdModules = ortb2Fragments.bidder[bidderName].user.ext.eids.map(eid => eid.source);