prebid.js 8.1.0 → 8.2.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 (183) hide show
  1. package/.devcontainer/devcontainer.json +3 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/admanBidAdapter.js +1 -1
  8. package/dist/adqueryBidAdapter.js +1 -1
  9. package/dist/adrelevantisBidAdapter.js +1 -1
  10. package/dist/adtrgtmeBidAdapter.js +1 -1
  11. package/dist/adxcgBidAdapter.js +1 -1
  12. package/dist/adyoulikeBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/appierAnalyticsAdapter.js +1 -1
  17. package/dist/appnexusBidAdapter.js +1 -1
  18. package/dist/asoBidAdapter.js +1 -1
  19. package/dist/axonixBidAdapter.js +1 -1
  20. package/dist/bidglassBidAdapter.js +1 -1
  21. package/dist/big-richmediaBidAdapter.js +1 -1
  22. package/dist/bridBidAdapter.js +1 -0
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/carodaBidAdapter.js +1 -1
  26. package/dist/categoryTranslation.js +1 -1
  27. package/dist/chtnwBidAdapter.js +1 -1
  28. package/dist/cmp.js +1 -0
  29. package/dist/concertBidAdapter.js +1 -1
  30. package/dist/connectadBidAdapter.js +1 -1
  31. package/dist/consentManagement.js +1 -1
  32. package/dist/consentManagementGpp.js +1 -1
  33. package/dist/consentManagementUsp.js +1 -1
  34. package/dist/consumableBidAdapter.js +1 -1
  35. package/dist/conversantAnalyticsAdapter.js +1 -1
  36. package/dist/conversantBidAdapter.js +1 -1
  37. package/dist/craftBidAdapter.js +1 -1
  38. package/dist/criteoBidAdapter.js +1 -1
  39. package/dist/cwireBidAdapter.js +1 -1
  40. package/dist/dependencies.json +12 -0
  41. package/dist/dspxBidAdapter.js +1 -1
  42. package/dist/eplanningBidAdapter.js +1 -1
  43. package/dist/euidIdSystem.js +1 -1
  44. package/dist/feedadBidAdapter.js +1 -1
  45. package/dist/finativeBidAdapter.js +1 -1
  46. package/dist/freewheel-sspBidAdapter.js +1 -1
  47. package/dist/gmosspBidAdapter.js +1 -1
  48. package/dist/goldbachBidAdapter.js +1 -1
  49. package/dist/gppControl_usnat.js +1 -0
  50. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  51. package/dist/greenbidsRtdProvider.js +1 -1
  52. package/dist/gridBidAdapter.js +1 -1
  53. package/dist/gumgumBidAdapter.js +1 -1
  54. package/dist/h12mediaBidAdapter.js +1 -1
  55. package/dist/hypelabBidAdapter.js +1 -1
  56. package/dist/id5IdSystem.js +1 -1
  57. package/dist/imdsBidAdapter.js +1 -1
  58. package/dist/improvedigitalBidAdapter.js +1 -1
  59. package/dist/insticatorBidAdapter.js +1 -1
  60. package/dist/intentIqIdSystem.js +1 -1
  61. package/dist/ixBidAdapter.js +1 -1
  62. package/dist/justpremiumBidAdapter.js +1 -1
  63. package/dist/kargoBidAdapter.js +1 -1
  64. package/dist/konduitAnalyticsAdapter.js +1 -1
  65. package/dist/kueezBidAdapter.js +1 -1
  66. package/dist/kueezRtbBidAdapter.js +1 -1
  67. package/dist/kulturemediaBidAdapter.js +1 -1
  68. package/dist/lassoBidAdapter.js +1 -1
  69. package/dist/lifestreetBidAdapter.js +1 -1
  70. package/dist/liveIntentIdSystem.js +1 -1
  71. package/dist/logicadBidAdapter.js +1 -1
  72. package/dist/loglyliftBidAdapter.js +1 -1
  73. package/dist/magniteAnalyticsAdapter.js +1 -1
  74. package/dist/malltvAnalyticsAdapter.js +1 -1
  75. package/dist/marsmediaBidAdapter.js +1 -1
  76. package/dist/mediafuseBidAdapter.js +1 -1
  77. package/dist/mediasquareBidAdapter.js +1 -1
  78. package/dist/mgidBidAdapter.js +1 -1
  79. package/dist/minutemediaBidAdapter.js +1 -1
  80. package/dist/minutemediaplusBidAdapter.js +1 -1
  81. package/dist/mspa.js +1 -0
  82. package/dist/nexx360BidAdapter.js +1 -1
  83. package/dist/not-for-prod/prebid.js +136 -132
  84. package/dist/oguryBidAdapter.js +1 -1
  85. package/dist/onetagBidAdapter.js +1 -1
  86. package/dist/ooloAnalyticsAdapter.js +1 -1
  87. package/dist/optidigitalBidAdapter.js +1 -1
  88. package/dist/outbrainBidAdapter.js +1 -1
  89. package/dist/oxxionRtdProvider.js +1 -1
  90. package/dist/parrableIdSystem.js +1 -1
  91. package/dist/pixfutureBidAdapter.js +1 -1
  92. package/dist/prebid-core.js +1 -1
  93. package/dist/publinkIdSystem.js +1 -1
  94. package/dist/pubmaticBidAdapter.js +1 -1
  95. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  96. package/dist/pxyzBidAdapter.js +1 -1
  97. package/dist/quantcastBidAdapter.js +1 -1
  98. package/dist/readpeakBidAdapter.js +1 -1
  99. package/dist/relaidoBidAdapter.js +1 -1
  100. package/dist/retailspotBidAdapter.js +1 -1
  101. package/dist/rhythmoneBidAdapter.js +1 -1
  102. package/dist/riseBidAdapter.js +1 -1
  103. package/dist/rubiconBidAdapter.js +1 -1
  104. package/dist/seedingAllianceBidAdapter.js +1 -1
  105. package/dist/seedtagBidAdapter.js +1 -1
  106. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  107. package/dist/sharethroughBidAdapter.js +1 -1
  108. package/dist/shinezBidAdapter.js +1 -1
  109. package/dist/smaatoBidAdapter.js +1 -1
  110. package/dist/smartadserverBidAdapter.js +1 -1
  111. package/dist/smartxBidAdapter.js +1 -1
  112. package/dist/smilewantedBidAdapter.js +1 -1
  113. package/dist/sonobiBidAdapter.js +1 -1
  114. package/dist/sovrnAnalyticsAdapter.js +1 -1
  115. package/dist/sovrnBidAdapter.js +1 -1
  116. package/dist/sspBCBidAdapter.js +1 -1
  117. package/dist/stvBidAdapter.js +1 -1
  118. package/dist/sublimeBidAdapter.js +1 -1
  119. package/dist/targetVideoBidAdapter.js +1 -1
  120. package/dist/teadsBidAdapter.js +1 -1
  121. package/dist/trionBidAdapter.js +1 -1
  122. package/dist/tripleliftBidAdapter.js +1 -1
  123. package/dist/ttdBidAdapter.js +1 -1
  124. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  125. package/dist/uid2IdSystem.js +1 -1
  126. package/dist/underdogmediaBidAdapter.js +1 -1
  127. package/dist/undertoneBidAdapter.js +1 -1
  128. package/dist/userId.js +1 -1
  129. package/dist/vidazooBidAdapter.js +1 -1
  130. package/dist/videobyteBidAdapter.js +1 -1
  131. package/dist/visxBidAdapter.js +1 -1
  132. package/dist/vuukleBidAdapter.js +1 -1
  133. package/dist/widespaceBidAdapter.js +1 -1
  134. package/dist/winrBidAdapter.js +1 -1
  135. package/dist/yahoosspBidAdapter.js +1 -1
  136. package/dist/yieldmoBidAdapter.js +1 -1
  137. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  138. package/libraries/cmp/cmpClient.js +139 -0
  139. package/libraries/mspa/activityControls.js +91 -0
  140. package/modules/admanBidAdapter.js +5 -0
  141. package/modules/bridBidAdapter.js +223 -0
  142. package/modules/categoryTranslation.js +3 -2
  143. package/modules/consentManagement.js +12 -86
  144. package/modules/consentManagementGpp.js +47 -126
  145. package/modules/consentManagementUsp.js +19 -97
  146. package/modules/gppControl_usnat.js +11 -0
  147. package/modules/intentIqIdSystem.js +6 -5
  148. package/modules/liveIntentIdSystem.js +8 -3
  149. package/modules/mediasquareBidAdapter.js +19 -23
  150. package/modules/oxxionRtdProvider.js +124 -11
  151. package/modules/oxxionRtdProvider.md +19 -4
  152. package/modules/tripleliftBidAdapter.js +21 -1
  153. package/modules/userId/eids.js +29 -0
  154. package/modules/userId/eids.md +19 -2
  155. package/modules/userId/index.js +78 -29
  156. package/modules/userId/userId.md +3 -0
  157. package/package.json +1 -1
  158. package/src/activities/params.js +4 -1
  159. package/test/spec/libraries/cmp/cmpClient_spec.js +233 -0
  160. package/test/spec/libraries/mspa/activityControls_spec.js +315 -0
  161. package/test/spec/modules/admanBidAdapter_spec.js +8 -2
  162. package/test/spec/modules/adqueryBidAdapter_spec.js +5 -1
  163. package/test/spec/modules/bridBidAdapter_spec.js +129 -0
  164. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +9 -7
  165. package/test/spec/modules/chtnwBidAdapter_spec.js +4 -1
  166. package/test/spec/modules/consentManagementGpp_spec.js +84 -7
  167. package/test/spec/modules/consentManagement_spec.js +8 -18
  168. package/test/spec/modules/datablocksBidAdapter_spec.js +7 -3
  169. package/test/spec/modules/eids_spec.js +87 -0
  170. package/test/spec/modules/insticatorBidAdapter_spec.js +6 -2
  171. package/test/spec/modules/intentIqIdSystem_spec.js +36 -2
  172. package/test/spec/modules/ixBidAdapter_spec.js +40 -12
  173. package/test/spec/modules/lassoBidAdapter_spec.js +6 -4
  174. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +17 -2
  175. package/test/spec/modules/liveIntentIdSystem_spec.js +11 -6
  176. package/test/spec/modules/mediasquareBidAdapter_spec.js +3 -0
  177. package/test/spec/modules/onetagBidAdapter_spec.js +81 -75
  178. package/test/spec/modules/orbidderBidAdapter_spec.js +6 -3
  179. package/test/spec/modules/oxxionRtdProvider_spec.js +113 -1
  180. package/test/spec/modules/relaidoBidAdapter_spec.js +4 -3
  181. package/test/spec/modules/tripleliftBidAdapter_spec.js +20 -1
  182. package/test/spec/modules/ucfunnelBidAdapter_spec.js +37 -16
  183. package/test/spec/modules/userId_spec.js +393 -6
@@ -86,6 +86,19 @@ describe('User ID', function () {
86
86
  }
87
87
  }
88
88
 
89
+ function createMockIdSubmodule(name, value, aliasName) {
90
+ return {
91
+ name,
92
+ getId() {
93
+ return value;
94
+ },
95
+ decode(v) {
96
+ return v;
97
+ },
98
+ aliasName
99
+ }
100
+ }
101
+
89
102
  function getAdUnitMock(code = 'adUnit-code') {
90
103
  return {
91
104
  code,
@@ -109,12 +122,6 @@ describe('User ID', function () {
109
122
  return cfg;
110
123
  }
111
124
 
112
- function findEid(eids, source) {
113
- return find(eids, (eid) => {
114
- if (eid.source === source) { return true; }
115
- });
116
- }
117
-
118
125
  let sandbox, consentData, startDelay, callbackDelay;
119
126
 
120
127
  function clearStack() {
@@ -397,6 +404,139 @@ describe('User ID', function () {
397
404
  })
398
405
  });
399
406
 
407
+ it('pbjs.getUserIds(Async) should prioritize user ids according to config available to core', () => {
408
+ init(config);
409
+
410
+ setSubmoduleRegistry([
411
+ createMockIdSubmodule('mockId1Module', {id: {mockId1: 'mockId1_value'}}),
412
+ createMockIdSubmodule('mockId2Module', {id: {mockId2: 'mockId2_value', mockId3: 'mockId3_value_from_mockId2Module'}}),
413
+ createMockIdSubmodule('mockId3Module', {id: {mockId1: 'mockId1_value_from_mockId3Module', mockId2: 'mockId2_value_from_mockId3Module', mockId3: 'mockId3_value', mockId4: 'mockId4_value_from_mockId3Module'}}),
414
+ createMockIdSubmodule('mockId4Module', {id: {mockId4: 'mockId4_value'}})
415
+ ]);
416
+
417
+ config.setConfig({
418
+ userSync: {
419
+ idPriority: {
420
+ mockId1: ['mockId3Module', 'mockId1Module'],
421
+ mockId4: ['mockId4Module', 'mockId3Module']
422
+ },
423
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
424
+ userIds: [
425
+ { name: 'mockId1Module' },
426
+ { name: 'mockId2Module' },
427
+ { name: 'mockId3Module' },
428
+ { name: 'mockId4Module' }
429
+ ]
430
+ }
431
+ });
432
+
433
+ return getGlobal().getUserIdsAsync().then((uids) => {
434
+ expect(uids['mockId1']).to.deep.equal('mockId1_value_from_mockId3Module');
435
+ expect(uids['mockId2']).to.deep.equal('mockId2_value');
436
+ expect(uids['mockId3']).to.deep.equal('mockId3_value_from_mockId2Module');
437
+ expect(uids['mockId4']).to.deep.equal('mockId4_value');
438
+ });
439
+ });
440
+
441
+ it('pbjs.getUserIds(Async) should prioritize user ids according to config available to core when config uses aliases', () => {
442
+ init(config);
443
+
444
+ setSubmoduleRegistry([
445
+ createMockIdSubmodule('mockId1Module', {id: {mockId1: 'mockId1_value'}}),
446
+ createMockIdSubmodule('mockId2Module', {id: {mockId2: 'mockId2_value', mockId3: 'mockId3_value_from_mockId2Module'}}, 'mockId2Module_alias'),
447
+ createMockIdSubmodule('mockId3Module', {id: {mockId1: 'mockId1_value_from_mockId3Module', mockId2: 'mockId2_value_from_mockId3Module', mockId3: 'mockId3_value', mockId4: 'mockId4_value_from_mockId3Module'}}, 'mockId3Module_alias'),
448
+ createMockIdSubmodule('mockId4Module', {id: {mockId4: 'mockId4_value'}})
449
+ ]);
450
+
451
+ config.setConfig({
452
+ userSync: {
453
+ idPriority: {
454
+ mockId1: ['mockId3Module_alias', 'mockId1Module'],
455
+ mockId4: ['mockId4Module', 'mockId3Module']
456
+ },
457
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
458
+ userIds: [
459
+ { name: 'mockId1Module' },
460
+ { name: 'mockId2Module' },
461
+ { name: 'mockId3Module' },
462
+ { name: 'mockId4Module' }
463
+ ]
464
+ }
465
+ });
466
+
467
+ return getGlobal().getUserIdsAsync().then((uids) => {
468
+ expect(uids['mockId1']).to.deep.equal('mockId1_value_from_mockId3Module');
469
+ expect(uids['mockId2']).to.deep.equal('mockId2_value');
470
+ expect(uids['mockId3']).to.deep.equal('mockId3_value_from_mockId2Module');
471
+ expect(uids['mockId4']).to.deep.equal('mockId4_value');
472
+ });
473
+ });
474
+
475
+ it('pbjs.getUserIds(Async) should prioritize user ids according to config available to core when called multiple times', () => {
476
+ init(config);
477
+
478
+ setSubmoduleRegistry([
479
+ createMockIdSubmodule('mockId1Module', {id: {mockId1: 'mockId1_value', mockId2: 'mockId2_value_from_mockId1Module'}}),
480
+ createMockIdSubmodule('mockId2Module', {id: {mockId1: 'mockId1_value_from_mockId2Module', mockId2: 'mockId2_value'}}),
481
+ ]);
482
+
483
+ config.setConfig({
484
+ userSync: {
485
+ idPriority: {
486
+ mockId1: ['mockId2Module', 'mockId1Module'],
487
+ mockId2: ['mockId1Module', 'mockId2Module']
488
+ },
489
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
490
+ userIds: [
491
+ { name: 'mockId1Module' },
492
+ { name: 'mockId2Module' }
493
+ ]
494
+ }
495
+ });
496
+
497
+ return getGlobal().getUserIdsAsync().then((uidsFirstRequest) => {
498
+ getGlobal().getUserIdsAsync().then((uidsSecondRequest) => {
499
+ expect(uidsFirstRequest['mockId1']).to.deep.equal('mockId1_value_from_mockId2Module');
500
+ expect(uidsFirstRequest['mockId2']).to.deep.equal('mockId2_value_from_mockId1Module');
501
+ expect(uidsFirstRequest).to.deep.equal(uidsSecondRequest);
502
+ })
503
+ });
504
+ });
505
+
506
+ it('pbjs.getUserIds(Async) with priority config but no collision', () => {
507
+ init(config);
508
+
509
+ setSubmoduleRegistry([
510
+ createMockIdSubmodule('mockId1Module', {id: {mockId1: 'mockId1_value'}}),
511
+ createMockIdSubmodule('mockId2Module', {id: {mockId2: 'mockId2_value'}}),
512
+ createMockIdSubmodule('mockId3Module', {id: undefined}),
513
+ createMockIdSubmodule('mockId4Module', {id: {mockId4: 'mockId4_value'}})
514
+ ]);
515
+
516
+ config.setConfig({
517
+ userSync: {
518
+ idPriority: {
519
+ mockId1: ['mockId3Module', 'mockId1Module'],
520
+ mockId4: ['mockId2Module', 'mockId4Module']
521
+ },
522
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
523
+ userIds: [
524
+ { name: 'mockId1Module' },
525
+ { name: 'mockId2Module' },
526
+ { name: 'mockId3Module' },
527
+ { name: 'mockId4Module' }
528
+ ]
529
+ }
530
+ });
531
+
532
+ return getGlobal().getUserIdsAsync().then((uids) => {
533
+ expect(uids['mockId1']).to.deep.equal('mockId1_value');
534
+ expect(uids['mockId2']).to.deep.equal('mockId2_value');
535
+ expect(uids['mockId3']).to.be.undefined;
536
+ expect(uids['mockId4']).to.deep.equal('mockId4_value');
537
+ });
538
+ });
539
+
400
540
  it('pbjs.getUserIdsAsEids', function (done) {
401
541
  init(config);
402
542
  setSubmoduleRegistry([sharedIdSystemSubmodule]);
@@ -416,6 +556,44 @@ describe('User ID', function () {
416
556
  });
417
557
  });
418
558
 
559
+ it('pbjs.getUserIdsAsEids should prioritize user ids according to config available to core', () => {
560
+ init(config);
561
+ setSubmoduleRegistry([
562
+ createMockIdSubmodule('mockId1Module', {id: {uid2: {id: 'uid2_value'}}}),
563
+ createMockIdSubmodule('mockId2Module', {id: {pubcid: 'pubcid_value', lipb: {lipbid: 'lipbid_value_from_mockId2Module'}}}),
564
+ createMockIdSubmodule('mockId3Module', {id: {uid2: {id: 'uid2_value_from_mockId3Module'}, pubcid: 'pubcid_value_from_mockId3Module', lipb: {lipbid: 'lipbid_value'}, merkleId: {id: 'merkleId_value_from_mockId3Module'}}}),
565
+ createMockIdSubmodule('mockId4Module', {id: {merkleId: {id: 'merkleId_value'}}})
566
+ ]);
567
+ config.setConfig({
568
+ userSync: {
569
+ idPriority: {
570
+ uid2: ['mockId3Module', 'mockId1Module'],
571
+ merkleId: ['mockId4Module', 'mockId3Module']
572
+ },
573
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
574
+ userIds: [
575
+ { name: 'mockId1Module' },
576
+ { name: 'mockId2Module' },
577
+ { name: 'mockId3Module' },
578
+ { name: 'mockId4Module' }
579
+ ]
580
+ }
581
+ });
582
+
583
+ const ids = {
584
+ 'uid2': { id: 'uid2_value_from_mockId3Module' },
585
+ 'pubcid': 'pubcid_value',
586
+ 'lipb': { lipbid: 'lipbid_value_from_mockId2Module' },
587
+ 'merkleId': { id: 'merkleId_value' }
588
+ };
589
+
590
+ return getGlobal().getUserIdsAsync().then(() => {
591
+ const eids = getGlobal().getUserIdsAsEids();
592
+ const expected = createEidsArray(ids);
593
+ expect(eids).to.deep.equal(expected);
594
+ });
595
+ });
596
+
419
597
  it('should set googletag ppid correctly', function () {
420
598
  let adUnits = [getAdUnitMock()];
421
599
  init(config);
@@ -441,6 +619,41 @@ describe('User ID', function () {
441
619
  });
442
620
  });
443
621
 
622
+ it('should set googletag ppid correctly when prioritized according to config available to core', () => {
623
+ let adUnits = [getAdUnitMock()];
624
+ init(config);
625
+ setSubmoduleRegistry([
626
+ // some of the ids are padded to have length >= 32 characters
627
+ createMockIdSubmodule('mockId1Module', {id: {uid2: {id: 'uid2_value_7ac66c0f148de9519b8bd264312c4d64'}}}),
628
+ createMockIdSubmodule('mockId2Module', {id: {pubcid: 'pubcid_value_7ac66c0f148de9519b8bd264312c4d64', lipb: {lipbid: 'lipbid_value_from_mockId2Module_7ac66c0f148de9519b8bd264312c4d64'}}}),
629
+ createMockIdSubmodule('mockId3Module', {id: {uid2: {id: 'uid2_value_from_mockId3Module_7ac66c0f148de9519b8bd264312c4d64'}, pubcid: 'pubcid_value_from_mockId3Module_7ac66c0f148de9519b8bd264312c4d64', lipb: {lipbid: 'lipbid_value_7ac66c0f148de9519b8bd264312c4d64'}, merkleId: {id: 'merkleId_value_from_mockId3Module_7ac66c0f148de9519b8bd264312c4d64'}}}),
630
+ createMockIdSubmodule('mockId4Module', {id: {merkleId: {id: 'merkleId_value_7ac66c0f148de9519b8bd264312c4d64'}}})
631
+ ]);
632
+
633
+ // before ppid should not be set
634
+ expect(window.googletag._ppid).to.equal(undefined);
635
+
636
+ config.setConfig({
637
+ userSync: {
638
+ ppid: 'uidapi.com',
639
+ idPriority: {
640
+ uid2: ['mockId3Module', 'mockId1Module'],
641
+ merkleId: ['mockId4Module', 'mockId3Module']
642
+ },
643
+ userIds: [
644
+ { name: 'mockId1Module' },
645
+ { name: 'mockId2Module' },
646
+ { name: 'mockId3Module' },
647
+ { name: 'mockId4Module' }
648
+ ]
649
+ }
650
+ });
651
+
652
+ return expectImmediateBidHook(() => {}, {adUnits}).then(() => {
653
+ expect(window.googletag._ppid).to.equal('uid2valuefrommockId3Module7ac66c0f148de9519b8bd264312c4d64');
654
+ });
655
+ });
656
+
444
657
  describe('submodule callback', () => {
445
658
  const TEST_KEY = 'testKey';
446
659
 
@@ -589,6 +802,40 @@ describe('User ID', function () {
589
802
  })
590
803
  });
591
804
 
805
+ it('should make PPID available to core and respect priority', () => {
806
+ init(config);
807
+ setSubmoduleRegistry([
808
+ // some of the ids are padded to have length >= 32 characters
809
+ createMockIdSubmodule('mockId1Module', {id: {uid2: {id: 'uid2_value_7ac66c0f148de9519b8bd264312c4d64'}}}),
810
+ createMockIdSubmodule('mockId2Module', {id: {pubcid: 'pubcid_value_7ac66c0f148de9519b8bd264312c4d64', lipb: {lipbid: 'lipbid_value_from_mockId2Module_7ac66c0f148de9519b8bd264312c4d64'}}}),
811
+ createMockIdSubmodule('mockId3Module', {id: {uid2: {id: 'uid2_value_from_mockId3Module_7ac66c0f148de9519b8bd264312c4d64'}, pubcid: 'pubcid_value_from_mockId3Module_7ac66c0f148de9519b8bd264312c4d64', lipb: {lipbid: 'lipbid_value_7ac66c0f148de9519b8bd264312c4d64'}, merkleId: {id: 'merkleId_value_from_mockId3Module_7ac66c0f148de9519b8bd264312c4d64'}}}),
812
+ createMockIdSubmodule('mockId4Module', {id: {merkleId: {id: 'merkleId_value_7ac66c0f148de9519b8bd264312c4d64'}}})
813
+ ]);
814
+
815
+ // before ppid should not be set
816
+ expect(window.googletag._ppid).to.equal(undefined);
817
+
818
+ config.setConfig({
819
+ userSync: {
820
+ ppid: 'uidapi.com',
821
+ idPriority: {
822
+ uid2: ['mockId3Module', 'mockId1Module'],
823
+ merkleId: ['mockId4Module', 'mockId3Module']
824
+ },
825
+ userIds: [
826
+ { name: 'mockId1Module' },
827
+ { name: 'mockId2Module' },
828
+ { name: 'mockId3Module' },
829
+ { name: 'mockId4Module' }
830
+ ]
831
+ }
832
+ });
833
+
834
+ return getGlobal().refreshUserIds().then(() => {
835
+ expect(getPPID()).to.eql('uid2valuefrommockId3Module7ac66c0f148de9519b8bd264312c4d64');
836
+ })
837
+ });
838
+
592
839
  describe('refreshing before init is complete', () => {
593
840
  const MOCK_ID = {'MOCKID': '1111'};
594
841
  let mockIdCallback;
@@ -763,6 +1010,63 @@ describe('User ID', function () {
763
1010
  });
764
1011
  });
765
1012
 
1013
+ it('pbjs.refreshUserIds updates priority config', () => {
1014
+ init(config);
1015
+
1016
+ setSubmoduleRegistry([
1017
+ createMockIdSubmodule('mockId1Module', {id: {mockId1: 'mockId1_value'}}),
1018
+ createMockIdSubmodule('mockId2Module', {id: {mockId2: 'mockId2_value', mockId3: 'mockId3_value_from_mockId2Module'}}),
1019
+ createMockIdSubmodule('mockId3Module', {id: {mockId1: 'mockId1_value_from_mockId3Module', mockId2: 'mockId2_value_from_mockId3Module', mockId3: 'mockId3_value', mockId4: 'mockId4_value_from_mockId3Module'}}),
1020
+ createMockIdSubmodule('mockId4Module', {id: {mockId4: 'mockId4_value'}})
1021
+ ]);
1022
+
1023
+ config.setConfig({
1024
+ userSync: {
1025
+ idPriority: {
1026
+ mockId1: ['mockId3Module', 'mockId1Module'],
1027
+ mockId4: ['mockId4Module', 'mockId3Module']
1028
+ },
1029
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
1030
+ userIds: [
1031
+ { name: 'mockId1Module' },
1032
+ { name: 'mockId2Module' },
1033
+ { name: 'mockId3Module' },
1034
+ { name: 'mockId4Module' }
1035
+ ]
1036
+ }
1037
+ });
1038
+
1039
+ return getGlobal().getUserIdsAsync().then((uids) => {
1040
+ expect(uids['mockId1']).to.deep.equal('mockId1_value_from_mockId3Module');
1041
+ expect(uids['mockId2']).to.deep.equal('mockId2_value');
1042
+ expect(uids['mockId3']).to.deep.equal('mockId3_value_from_mockId2Module');
1043
+ expect(uids['mockId4']).to.deep.equal('mockId4_value');
1044
+
1045
+ config.setConfig({
1046
+ userSync: {
1047
+ idPriority: {
1048
+ mockId1: ['mockId1Module', 'mockId3Module'],
1049
+ mockId4: ['mockId3Module', 'mockId4Module']
1050
+ },
1051
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
1052
+ userIds: [
1053
+ { name: 'mockId1Module' },
1054
+ { name: 'mockId2Module' },
1055
+ { name: 'mockId3Module' },
1056
+ { name: 'mockId4Module' }
1057
+ ]
1058
+ }
1059
+ });
1060
+
1061
+ return getGlobal().getUserIdsAsync().then((uids) => {
1062
+ expect(uids['mockId1']).to.deep.equal('mockId1_value');
1063
+ expect(uids['mockId2']).to.deep.equal('mockId2_value');
1064
+ expect(uids['mockId3']).to.deep.equal('mockId3_value_from_mockId2Module');
1065
+ expect(uids['mockId4']).to.deep.equal('mockId4_value_from_mockId3Module');
1066
+ });
1067
+ });
1068
+ });
1069
+
766
1070
  it('pbjs.refreshUserIds refreshes single', function() {
767
1071
  coreStorage.setCookie('MOCKID', '', EXPIRED_COOKIE_DATE);
768
1072
  coreStorage.setCookie('REFRESH', '', EXPIRED_COOKIE_DATE);
@@ -2950,6 +3254,50 @@ describe('User ID', function () {
2950
3254
  }).catch(done);
2951
3255
  });
2952
3256
 
3257
+ it('pbjs.getEncryptedEidsForSource should return prioritized id as non-encrypted string', (done) => {
3258
+ init(config);
3259
+ setSubmoduleRegistry([
3260
+ createMockIdSubmodule('mockId1Module', {id: {uid2: {id: 'uid2_value'}}}),
3261
+ createMockIdSubmodule('mockId2Module', {id: {pubcid: 'pubcid_value', lipb: {lipbid: 'lipbid_value_from_mockId2Module'}}}),
3262
+ createMockIdSubmodule('mockId3Module', {id: {uid2: {id: 'uid2_value_from_mockId3Module'}, pubcid: 'pubcid_value_from_mockId3Module', lipb: {lipbid: 'lipbid_value'}, merkleId: {id: 'merkleId_value_from_mockId3Module'}}}),
3263
+ createMockIdSubmodule('mockId4Module', {id: {merkleId: {id: 'merkleId_value'}}})
3264
+ ]);
3265
+ config.setConfig({
3266
+ userSync: {
3267
+ idPriority: {
3268
+ uid2: ['mockId3Module', 'mockId1Module'],
3269
+ merkleId: ['mockId4Module', 'mockId3Module']
3270
+ },
3271
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
3272
+ userIds: [
3273
+ { name: 'mockId1Module' },
3274
+ { name: 'mockId2Module' },
3275
+ { name: 'mockId3Module' },
3276
+ { name: 'mockId4Module' }
3277
+ ]
3278
+ }
3279
+ });
3280
+
3281
+ const expctedIds = [
3282
+ 'pubcid_value',
3283
+ 'uid2_value_from_mockId3Module',
3284
+ 'merkleId_value',
3285
+ 'lipbid_value_from_mockId2Module'
3286
+ ];
3287
+
3288
+ const encrypt = false;
3289
+
3290
+ Promise.all([
3291
+ getGlobal().getEncryptedEidsForSource('pubcid.org', encrypt),
3292
+ getGlobal().getEncryptedEidsForSource('uidapi.com', encrypt),
3293
+ getGlobal().getEncryptedEidsForSource('merkleinc.com', encrypt),
3294
+ getGlobal().getEncryptedEidsForSource('liveintent.com', encrypt)
3295
+ ]).then((result) => {
3296
+ expect(result).to.deep.equal(expctedIds);
3297
+ done();
3298
+ })
3299
+ });
3300
+
2953
3301
  describe('pbjs.getEncryptedEidsForSource', () => {
2954
3302
  beforeEach(() => {
2955
3303
  init(config);
@@ -3013,6 +3361,45 @@ describe('User ID', function () {
3013
3361
  done();
3014
3362
  });
3015
3363
  });
3364
+
3365
+ it('pbjs.getUserIdsAsEidBySource with priority config available to core', () => {
3366
+ init(config);
3367
+ setSubmoduleRegistry([
3368
+ createMockIdSubmodule('mockId1Module', {id: {uid2: {id: 'uid2_value'}}}),
3369
+ createMockIdSubmodule('mockId2Module', {id: {pubcid: 'pubcid_value', lipb: {lipbid: 'lipbid_value_from_mockId2Module'}}}),
3370
+ createMockIdSubmodule('mockId3Module', {id: {uid2: {id: 'uid2_value_from_mockId3Module'}, pubcid: 'pubcid_value_from_mockId3Module', lipb: {lipbid: 'lipbid_value'}, merkleId: {id: 'merkleId_value_from_mockId3Module'}}}),
3371
+ createMockIdSubmodule('mockId4Module', {id: {merkleId: {id: 'merkleId_value'}}})
3372
+ ]);
3373
+ config.setConfig({
3374
+ userSync: {
3375
+ idPriority: {
3376
+ uid2: ['mockId3Module', 'mockId1Module'],
3377
+ merkleId: ['mockId4Module', 'mockId3Module']
3378
+ },
3379
+ auctionDelay: 10, // with auctionDelay > 0, no auction is needed to complete init
3380
+ userIds: [
3381
+ { name: 'mockId1Module' },
3382
+ { name: 'mockId2Module' },
3383
+ { name: 'mockId3Module' },
3384
+ { name: 'mockId4Module' }
3385
+ ]
3386
+ }
3387
+ });
3388
+
3389
+ const ids = {
3390
+ 'uidapi.com': {'uid2': {id: 'uid2_value_from_mockId3Module'}},
3391
+ 'pubcid.org': {'pubcid': 'pubcid_value'},
3392
+ 'liveintent.com': {'lipb': {lipbid: 'lipbid_value_from_mockId2Module'}},
3393
+ 'merkleinc.com': {'merkleId': {id: 'merkleId_value'}}
3394
+ };
3395
+
3396
+ return getGlobal().getUserIdsAsync().then(() => {
3397
+ expect(getGlobal().getUserIdsAsEidBySource('pubcid.org')).to.deep.equal(createEidsArray(ids['pubcid.org'])[0]);
3398
+ expect(getGlobal().getUserIdsAsEidBySource('uidapi.com')).to.deep.equal(createEidsArray(ids['uidapi.com'])[0]);
3399
+ expect(getGlobal().getUserIdsAsEidBySource('merkleinc.com')).to.deep.equal(createEidsArray(ids['merkleinc.com'])[0]);
3400
+ expect(getGlobal().getUserIdsAsEidBySource('liveintent.com')).to.deep.equal(createEidsArray(ids['liveintent.com'])[0]);
3401
+ });
3402
+ });
3016
3403
  })
3017
3404
  });
3018
3405
  });