prebid.js 9.6.0 → 9.8.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 (274) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE.md +1 -1
  2. package/.github/codeql/codeql-config.yml +3 -0
  3. package/.github/codeql/queries/deviceMemory.ql +14 -0
  4. package/.github/codeql/queries/hardwareConcurrency.ql +14 -0
  5. package/.github/codeql/queries/prebid.qll +36 -0
  6. package/.github/codeql/queries/qlpack.yml +8 -0
  7. package/.github/release-drafter.yml +4 -0
  8. package/.github/workflows/jscpd.yml +1 -1
  9. package/README.md +4 -4
  10. package/dist/33acrossAnalyticsAdapter.js +1 -1
  11. package/dist/33acrossBidAdapter.js +1 -1
  12. package/dist/33acrossIdSystem.js +1 -1
  13. package/dist/BTBidAdapter.js +1 -1
  14. package/dist/adagioAnalyticsAdapter.js +1 -1
  15. package/dist/adagioBidAdapter.js +1 -1
  16. package/dist/adagioUtils.js +1 -1
  17. package/dist/addefendBidAdapter.js +1 -1
  18. package/dist/adgenerationBidAdapter.js +1 -1
  19. package/dist/adlooxRtdProvider.js +1 -1
  20. package/dist/admixerBidAdapter.js +1 -1
  21. package/dist/adqueryBidAdapter.js +1 -1
  22. package/dist/adrelevantisBidAdapter.js +1 -1
  23. package/dist/adstirBidAdapter.js +1 -1
  24. package/dist/adtrgtmeBidAdapter.js +1 -1
  25. package/dist/adxcgAnalyticsAdapter.js +1 -1
  26. package/dist/adxcgBidAdapter.js +1 -1
  27. package/dist/adyoulikeBidAdapter.js +1 -1
  28. package/dist/agmaAnalyticsAdapter.js +1 -1
  29. package/dist/ajaBidAdapter.js +1 -1
  30. package/dist/amxBidAdapter.js +1 -1
  31. package/dist/amxIdSystem.js +1 -1
  32. package/dist/appierAnalyticsAdapter.js +1 -1
  33. package/dist/appnexusBidAdapter.js +1 -1
  34. package/dist/asoBidAdapter.js +1 -1
  35. package/dist/axonixBidAdapter.js +1 -1
  36. package/dist/bidglassBidAdapter.js +1 -1
  37. package/dist/big-richmediaBidAdapter.js +1 -1
  38. package/dist/bridBidAdapter.js +1 -1
  39. package/dist/bridgewellBidAdapter.js +1 -1
  40. package/dist/brightMountainMediaBidAdapter.js +1 -1
  41. package/dist/carodaBidAdapter.js +1 -1
  42. package/dist/ccxBidAdapter.js +1 -1
  43. package/dist/chtnwBidAdapter.js +1 -1
  44. package/dist/chunk-core.js +1 -1
  45. package/dist/cleanmedianetBidAdapter.js +1 -1
  46. package/dist/concertBidAdapter.js +1 -1
  47. package/dist/connectadBidAdapter.js +1 -1
  48. package/dist/connectionInfo.js +1 -0
  49. package/dist/consumableBidAdapter.js +1 -1
  50. package/dist/contxtfulRtdProvider.js +1 -1
  51. package/dist/conversantAnalyticsAdapter.js +1 -1
  52. package/dist/conversantBidAdapter.js +1 -1
  53. package/dist/craftBidAdapter.js +1 -1
  54. package/dist/criteoBidAdapter.js +1 -1
  55. package/dist/cwireBidAdapter.js +1 -1
  56. package/dist/dailymotionBidAdapter.js +1 -1
  57. package/dist/dependencies.json +16 -3
  58. package/dist/discoveryBidAdapter.js +1 -1
  59. package/dist/docereeAdManagerBidAdapter.js +1 -1
  60. package/dist/dspxBidAdapter.js +1 -1
  61. package/dist/dxkultureBidAdapter.js +1 -1
  62. package/dist/eightPodAnalyticsAdapter.js +1 -1
  63. package/dist/eplanningBidAdapter.js +1 -1
  64. package/dist/euidIdSystem.js +1 -1
  65. package/dist/exadsBidAdapter.js +1 -1
  66. package/dist/feedadBidAdapter.js +1 -1
  67. package/dist/finativeBidAdapter.js +1 -1
  68. package/dist/freewheel-sspBidAdapter.js +1 -1
  69. package/dist/gamoshiBidAdapter.js +1 -1
  70. package/dist/gmosspBidAdapter.js +1 -1
  71. package/dist/goldbachBidAdapter.js +1 -1
  72. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  73. package/dist/greenbidsRtdProvider.js +1 -1
  74. package/dist/gridBidAdapter.js +1 -1
  75. package/dist/gumgumBidAdapter.js +1 -1
  76. package/dist/h12mediaBidAdapter.js +1 -1
  77. package/dist/hypelabBidAdapter.js +1 -1
  78. package/dist/id5AnalyticsAdapter.js +1 -1
  79. package/dist/id5IdSystem.js +1 -1
  80. package/dist/idImportLibrary.js +1 -1
  81. package/dist/imdsBidAdapter.js +1 -1
  82. package/dist/improvedigitalBidAdapter.js +1 -1
  83. package/dist/insticatorBidAdapter.js +1 -1
  84. package/dist/intentIqAnalyticsAdapter.js +1 -1
  85. package/dist/ixBidAdapter.js +1 -1
  86. package/dist/jixieBidAdapter.js +1 -1
  87. package/dist/justpremiumBidAdapter.js +1 -1
  88. package/dist/kargoBidAdapter.js +1 -1
  89. package/dist/kimberliteBidAdapter.js +1 -1
  90. package/dist/konduitAnalyticsAdapter.js +1 -1
  91. package/dist/kueezBidAdapter.js +1 -1
  92. package/dist/lassoBidAdapter.js +1 -1
  93. package/dist/lifestreetBidAdapter.js +1 -1
  94. package/dist/liveIntentIdSystem.js +1 -1
  95. package/dist/logicadBidAdapter.js +1 -1
  96. package/dist/loglyliftBidAdapter.js +1 -1
  97. package/dist/luceadBidAdapter.js +1 -1
  98. package/dist/mabidderBidAdapter.js +1 -1
  99. package/dist/magniteAnalyticsAdapter.js +1 -1
  100. package/dist/malltvAnalyticsAdapter.js +1 -1
  101. package/dist/marsmediaBidAdapter.js +1 -1
  102. package/dist/mediafuseBidAdapter.js +1 -1
  103. package/dist/mediagoBidAdapter.js +1 -1
  104. package/dist/medianetAnalyticsAdapter.js +1 -1
  105. package/dist/medianetBidAdapter.js +1 -1
  106. package/dist/mediasquareBidAdapter.js +1 -1
  107. package/dist/mgidBidAdapter.js +1 -1
  108. package/dist/mgidUtils.js +1 -0
  109. package/dist/mgidXBidAdapter.js +1 -1
  110. package/dist/missenaBidAdapter.js +1 -1
  111. package/dist/mobianRtdProvider.js +1 -1
  112. package/dist/navigatorData.js +1 -0
  113. package/dist/nexx360BidAdapter.js +1 -1
  114. package/dist/nobidAnalyticsAdapter.js +1 -1
  115. package/dist/nobidBidAdapter.js +1 -1
  116. package/dist/not-for-prod/prebid.js +176 -170
  117. package/dist/oguryBidAdapter.js +1 -1
  118. package/dist/omsBidAdapter.js +1 -1
  119. package/dist/onetagBidAdapter.js +1 -1
  120. package/dist/ooloAnalyticsAdapter.js +1 -1
  121. package/dist/openxBidAdapter.js +1 -1
  122. package/dist/optidigitalBidAdapter.js +1 -1
  123. package/dist/orbidderBidAdapter.js +1 -1
  124. package/dist/ortbConverter.js +1 -1
  125. package/dist/outbrainBidAdapter.js +1 -1
  126. package/dist/ownadxBidAdapter.js +1 -0
  127. package/dist/pixfutureBidAdapter.js +1 -1
  128. package/dist/prismaBidAdapter.js +1 -1
  129. package/dist/publinkIdSystem.js +1 -1
  130. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  131. package/dist/pubmaticBidAdapter.js +1 -1
  132. package/dist/pubriseBidAdapter.js +1 -0
  133. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  134. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  135. package/dist/pubxaiRtdProvider.js +1 -1
  136. package/dist/pxyzBidAdapter.js +1 -1
  137. package/dist/quantcastBidAdapter.js +1 -1
  138. package/dist/readpeakBidAdapter.js +1 -1
  139. package/dist/redtramBidAdapter.js +1 -1
  140. package/dist/relaidoBidAdapter.js +1 -1
  141. package/dist/retailspotBidAdapter.js +1 -1
  142. package/dist/rhythmoneBidAdapter.js +1 -1
  143. package/dist/riseUtils.js +1 -1
  144. package/dist/rubiconBidAdapter.js +1 -1
  145. package/dist/seedingAllianceBidAdapter.js +1 -1
  146. package/dist/seedtagBidAdapter.js +1 -1
  147. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  148. package/dist/sharethroughBidAdapter.js +1 -1
  149. package/dist/smaatoBidAdapter.js +1 -1
  150. package/dist/smartadserverBidAdapter.js +1 -1
  151. package/dist/smarthubBidAdapter.js +1 -1
  152. package/dist/smartxBidAdapter.js +1 -1
  153. package/dist/smilewantedBidAdapter.js +1 -1
  154. package/dist/snigelBidAdapter.js +1 -1
  155. package/dist/sonobiBidAdapter.js +1 -1
  156. package/dist/sovrnBidAdapter.js +1 -1
  157. package/dist/sspBCBidAdapter.js +1 -1
  158. package/dist/stvBidAdapter.js +1 -1
  159. package/dist/sublimeBidAdapter.js +1 -1
  160. package/dist/taboolaBidAdapter.js +1 -1
  161. package/dist/tappxBidAdapter.js +1 -1
  162. package/dist/targetVideoBidAdapter.js +1 -1
  163. package/dist/teadsBidAdapter.js +1 -1
  164. package/dist/terceptAnalyticsAdapter.js +1 -1
  165. package/dist/themoneytizerBidAdapter.js +1 -1
  166. package/dist/trionBidAdapter.js +1 -1
  167. package/dist/tripleliftBidAdapter.js +1 -1
  168. package/dist/ttdBidAdapter.js +1 -1
  169. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  170. package/dist/uid2IdSystem.js +1 -1
  171. package/dist/underdogmediaBidAdapter.js +1 -1
  172. package/dist/undertoneBidAdapter.js +1 -1
  173. package/dist/unrulyBidAdapter.js +1 -1
  174. package/dist/userId.js +1 -1
  175. package/dist/viantOrtbBidAdapter.js +1 -1
  176. package/dist/vidazooUtils.js +1 -1
  177. package/dist/videobyteBidAdapter.js +1 -1
  178. package/dist/visxBidAdapter.js +1 -1
  179. package/dist/vuukleBidAdapter.js +1 -1
  180. package/dist/widespaceBidAdapter.js +1 -1
  181. package/dist/winrBidAdapter.js +1 -1
  182. package/dist/wurflRtdProvider.js +1 -0
  183. package/dist/yahooAdsBidAdapter.js +1 -1
  184. package/dist/yieldmoBidAdapter.js +1 -1
  185. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  186. package/integrationExamples/gpt/wurflRtdProvider_example.html +106 -0
  187. package/libraries/connectionInfo/connectionUtils.js +33 -0
  188. package/libraries/mgidUtils/mgidUtils.js +73 -0
  189. package/{src/fpd/navigator.js → libraries/navigatorData/navigatorData.js} +1 -1
  190. package/libraries/ortbConverter/processors/video.js +2 -24
  191. package/libraries/riseUtils/index.js +2 -1
  192. package/libraries/vidazooUtils/bidderUtils.js +16 -0
  193. package/modules/.submodules.json +3 -1
  194. package/modules/51DegreesRtdProvider.md +11 -7
  195. package/modules/adagioBidAdapter.js +10 -50
  196. package/modules/admixerBidAdapter.js +12 -5
  197. package/modules/appnexusBidAdapter.js +1 -1
  198. package/modules/ccxBidAdapter.js +6 -2
  199. package/modules/cleanmedianetBidAdapter.js +1 -1
  200. package/modules/contxtfulRtdProvider.js +15 -12
  201. package/modules/cwireBidAdapter.js +13 -9
  202. package/modules/cwireBidAdapter.md +29 -10
  203. package/modules/dailymotionBidAdapter.js +20 -1
  204. package/modules/dailymotionBidAdapter.md +11 -7
  205. package/modules/discoveryBidAdapter.js +1 -1
  206. package/modules/docereeAdManagerBidAdapter.js +9 -12
  207. package/modules/eightPodAnalyticsAdapter.js +13 -1
  208. package/modules/gamoshiBidAdapter.js +1 -1
  209. package/modules/greenbidsAnalyticsAdapter.js +7 -4
  210. package/modules/greenbidsRtdProvider.js +15 -5
  211. package/modules/id5IdSystem.js +14 -93
  212. package/modules/idImportLibrary.js +14 -6
  213. package/modules/ixBidAdapter.js +0 -1
  214. package/modules/mediagoBidAdapter.js +4 -4
  215. package/modules/mgidBidAdapter.js +30 -109
  216. package/modules/mgidXBidAdapter.js +2 -66
  217. package/modules/mobianRtdProvider.js +28 -14
  218. package/modules/omsBidAdapter.js +1 -1
  219. package/modules/ownadxBidAdapter.js +99 -0
  220. package/modules/prismaBidAdapter.js +1 -27
  221. package/modules/pubmaticBidAdapter.js +2 -1
  222. package/modules/pubriseBidAdapter.js +19 -0
  223. package/modules/pubriseBidAdapter.md +79 -0
  224. package/modules/pubxaiAnalyticsAdapter.js +9 -4
  225. package/modules/pubxaiRtdProvider.js +38 -18
  226. package/modules/pubxaiRtdProvider.md +2 -2
  227. package/modules/redtramBidAdapter.js +2 -6
  228. package/modules/rubiconBidAdapter.js +3 -3
  229. package/modules/sharethroughBidAdapter.js +5 -0
  230. package/modules/smarthubBidAdapter.js +2 -0
  231. package/modules/teadsBidAdapter.js +4 -3
  232. package/modules/ttdBidAdapter.js +14 -32
  233. package/modules/undertoneBidAdapter.js +1 -19
  234. package/modules/userId/index.js +1 -1
  235. package/modules/viantOrtbBidAdapter.js +1 -1
  236. package/modules/wurflRtdProvider.js +213 -0
  237. package/modules/wurflRtdProvider.md +67 -0
  238. package/package.json +1 -1
  239. package/src/adloader.js +1 -0
  240. package/src/prebid.js +2 -1
  241. package/src/utils/focusTimeout.js +17 -6
  242. package/src/utils/ttlCollection.js +1 -1
  243. package/src/utils.js +28 -0
  244. package/src/video.js +78 -1
  245. package/test/spec/modules/adagioBidAdapter_spec.js +0 -1
  246. package/test/spec/modules/admixerBidAdapter_spec.js +2 -2
  247. package/test/spec/modules/appnexusBidAdapter_spec.js +0 -33
  248. package/test/spec/modules/ccxBidAdapter_spec.js +81 -0
  249. package/test/spec/modules/cleanmedianetBidAdapter_spec.js +1 -1
  250. package/test/spec/modules/contxtfulRtdProvider_spec.js +19 -19
  251. package/test/spec/modules/dailymotionBidAdapter_spec.js +62 -12
  252. package/test/spec/modules/discoveryBidAdapter_spec.js +1 -1
  253. package/test/spec/modules/docereeAdManagerBidAdapter_spec.js +1 -0
  254. package/test/spec/modules/gamoshiBidAdapter_spec.js +1 -1
  255. package/test/spec/modules/id5IdSystem_spec.js +25 -98
  256. package/test/spec/modules/idImportLibrary_spec.js +14 -0
  257. package/test/spec/modules/ixBidAdapter_spec.js +8 -1
  258. package/test/spec/modules/mobianRtdProvider_spec.js +46 -43
  259. package/test/spec/modules/openxBidAdapter_spec.js +1 -1
  260. package/test/spec/modules/ownadxBidAdapter_spec.js +103 -0
  261. package/test/spec/modules/pubmaticBidAdapter_spec.js +18 -0
  262. package/test/spec/modules/pubriseBidAdapter_spec.js +514 -0
  263. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +9 -4
  264. package/test/spec/modules/pubxaiRtdProvider_spec.js +37 -5
  265. package/test/spec/modules/rubiconBidAdapter_spec.js +10 -0
  266. package/test/spec/modules/sharethroughBidAdapter_spec.js +35 -0
  267. package/test/spec/modules/trafficgateBidAdapter_spec.js +1 -1
  268. package/test/spec/modules/ttdBidAdapter_spec.js +10 -1
  269. package/test/spec/modules/viantOrtbBidAdapter_spec.js +1 -1
  270. package/test/spec/modules/vidazooBidAdapter_spec.js +12 -4
  271. package/test/spec/modules/wurflRtdProvider_spec.js +324 -0
  272. package/test/spec/ortbConverter/userId_spec.js +23 -2
  273. package/test/spec/unit/utils/focusTimeout_spec.js +33 -6
  274. package/test/spec/video_spec.js +103 -1
@@ -93,6 +93,15 @@ describe('ID5 ID System', function () {
93
93
  'Content-Type': 'application/json'
94
94
  };
95
95
 
96
+ function expDaysStr(expDays) {
97
+ return (new Date(Date.now() + (1000 * 60 * 60 * 24 * expDays))).toUTCString();
98
+ }
99
+
100
+ function storeInStorage(key, value, expDays) {
101
+ id5System.storage.setDataInLocalStorage(`${key}_exp`, expDaysStr(expDays));
102
+ id5System.storage.setDataInLocalStorage(`${key}`, value);
103
+ }
104
+
96
105
  function getId5FetchConfig(partner = ID5_TEST_PARTNER_ID, storageName = id5System.ID5_STORAGE_NAME, storageType = 'html5') {
97
106
  return {
98
107
  name: ID5_MODULE_NAME,
@@ -637,8 +646,6 @@ describe('ID5 ID System', function () {
637
646
 
638
647
  it('should call the ID5 server with nb=1 when no stored value exists and reset after', async function () {
639
648
  const xhrServerMock = new XhrServerMock(server);
640
- const TEST_PARTNER_ID = 189;
641
- coreStorage.removeDataFromLocalStorage(id5System.nbCacheName(TEST_PARTNER_ID));
642
649
 
643
650
  // Trigger the fetch but we await on it later
644
651
  const submoduleResponsePromise = callSubmoduleGetId(getId5FetchConfig(), undefined, ID5_STORED_OBJ);
@@ -648,28 +655,28 @@ describe('ID5 ID System', function () {
648
655
  expect(requestBody.nbPage).is.eq(1);
649
656
 
650
657
  fetchRequest.respond(200, responseHeader, JSON.stringify(ID5_JSON_RESPONSE));
651
- await submoduleResponsePromise;
658
+ const response = await submoduleResponsePromise;
652
659
 
653
- expect(id5System.getNbFromCache(TEST_PARTNER_ID)).is.eq(0);
660
+ expect(response.nbPage).is.undefined;
654
661
  });
655
662
 
656
663
  it('should call the ID5 server with incremented nb when stored value exists and reset after', async function () {
657
664
  const xhrServerMock = new XhrServerMock(server);
658
665
  const TEST_PARTNER_ID = 189;
659
666
  const config = getId5FetchConfig(TEST_PARTNER_ID);
660
- id5System.storeNbInCache(TEST_PARTNER_ID, 1);
667
+ const storedObj = {...ID5_STORED_OBJ, nbPage: 1};
661
668
 
662
669
  // Trigger the fetch but we await on it later
663
- const submoduleResponsePromise = callSubmoduleGetId(config, undefined, ID5_STORED_OBJ);
670
+ const submoduleResponsePromise = callSubmoduleGetId(config, undefined, storedObj);
664
671
 
665
672
  const fetchRequest = await xhrServerMock.expectFetchRequest();
666
673
  const requestBody = JSON.parse(fetchRequest.requestBody);
667
674
  expect(requestBody.nbPage).is.eq(2);
668
675
 
669
676
  fetchRequest.respond(200, responseHeader, JSON.stringify(ID5_JSON_RESPONSE));
670
- await submoduleResponsePromise;
677
+ const response = await submoduleResponsePromise;
671
678
 
672
- expect(id5System.getNbFromCache(TEST_PARTNER_ID)).is.eq(0);
679
+ expect(response.nbPage).is.undefined;
673
680
  });
674
681
 
675
682
  it('should call the ID5 server with ab_testing object when abTesting is turned on', async function () {
@@ -720,45 +727,6 @@ describe('ID5 ID System', function () {
720
727
  await submoduleResponsePromise;
721
728
  });
722
729
 
723
- it('should store the privacy object from the ID5 server response', async function () {
724
- const xhrServerMock = new XhrServerMock(server);
725
-
726
- // Trigger the fetch but we await on it later
727
- const submoduleResponsePromise = callSubmoduleGetId(getId5FetchConfig(), undefined, ID5_STORED_OBJ);
728
-
729
- const privacy = {
730
- jurisdiction: 'gdpr',
731
- id5_consent: true
732
- };
733
-
734
- const fetchRequest = await xhrServerMock.expectFetchRequest();
735
- const responseObject = utils.deepClone(ID5_JSON_RESPONSE);
736
- responseObject.privacy = privacy;
737
-
738
- fetchRequest.respond(200, responseHeader, JSON.stringify(responseObject));
739
- await submoduleResponsePromise;
740
-
741
- expect(id5System.getFromLocalStorage(id5System.ID5_PRIVACY_STORAGE_NAME)).is.eq(JSON.stringify(privacy));
742
- coreStorage.removeDataFromLocalStorage(id5System.ID5_PRIVACY_STORAGE_NAME);
743
- });
744
-
745
- it('should not store a privacy object if not part of ID5 server response', async function () {
746
- const xhrServerMock = new XhrServerMock(server);
747
- coreStorage.removeDataFromLocalStorage(id5System.ID5_PRIVACY_STORAGE_NAME);
748
-
749
- // Trigger the fetch but we await on it later
750
- const submoduleResponsePromise = callSubmoduleGetId(getId5FetchConfig(), undefined, ID5_STORED_OBJ);
751
-
752
- const fetchRequest = await xhrServerMock.expectFetchRequest();
753
- const responseObject = utils.deepClone(ID5_JSON_RESPONSE);
754
- responseObject.privacy = undefined;
755
-
756
- fetchRequest.respond(200, responseHeader, JSON.stringify(responseObject));
757
- await submoduleResponsePromise;
758
-
759
- expect(id5System.getFromLocalStorage(id5System.ID5_PRIVACY_STORAGE_NAME)).is.null;
760
- });
761
-
762
730
  describe('with successful external module call', function () {
763
731
  const MOCK_RESPONSE = {
764
732
  ...ID5_JSON_RESPONSE,
@@ -926,7 +894,6 @@ describe('ID5 ID System', function () {
926
894
  sinon.stub(events, 'getEvents').returns([]);
927
895
  coreStorage.removeDataFromLocalStorage(id5System.ID5_STORAGE_NAME);
928
896
  coreStorage.removeDataFromLocalStorage(`${id5System.ID5_STORAGE_NAME}_last`);
929
- coreStorage.removeDataFromLocalStorage(id5System.nbCacheName(ID5_TEST_PARTNER_ID));
930
897
  coreStorage.setDataInLocalStorage(id5System.ID5_STORAGE_NAME + '_cst', getConsentHash());
931
898
  adUnits = [getAdUnitMock()];
932
899
  });
@@ -934,19 +901,18 @@ describe('ID5 ID System', function () {
934
901
  events.getEvents.restore();
935
902
  coreStorage.removeDataFromLocalStorage(id5System.ID5_STORAGE_NAME);
936
903
  coreStorage.removeDataFromLocalStorage(`${id5System.ID5_STORAGE_NAME}_last`);
937
- coreStorage.removeDataFromLocalStorage(id5System.nbCacheName(ID5_TEST_PARTNER_ID));
938
904
  coreStorage.removeDataFromLocalStorage(id5System.ID5_STORAGE_NAME + '_cst');
939
905
  sandbox.restore();
940
906
  });
941
907
 
942
908
  it('should add stored ID from cache to bids', function (done) {
943
- id5System.storeInLocalStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ), 1);
909
+ storeInStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ), 1);
944
910
 
945
911
  init(config);
946
912
  setSubmoduleRegistry([id5System.id5IdSubmodule]);
947
913
  config.setConfig(getFetchLocalStorageConfig());
948
914
 
949
- requestBidsHook(function () {
915
+ requestBidsHook(wrapAsyncExpects(done, () => {
950
916
  adUnits.forEach(unit => {
951
917
  unit.bids.forEach(bid => {
952
918
  expect(bid).to.have.deep.nested.property(`userId.${ID5_EIDS_NAME}`);
@@ -964,11 +930,11 @@ describe('ID5 ID System', function () {
964
930
  });
965
931
  });
966
932
  done();
967
- }, {adUnits});
933
+ }), {adUnits});
968
934
  });
969
935
 
970
936
  it('should add stored EUID from cache to bids', function (done) {
971
- id5System.storeInLocalStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ_WITH_EUID), 1);
937
+ storeInStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ_WITH_EUID), 1);
972
938
 
973
939
  init(config);
974
940
  setSubmoduleRegistry([id5System.id5IdSubmodule]);
@@ -997,7 +963,7 @@ describe('ID5 ID System', function () {
997
963
  });
998
964
 
999
965
  it('should add stored TRUE_LINK_ID from cache to bids', function (done) {
1000
- id5System.storeInLocalStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ_WITH_TRUE_LINK), 1);
966
+ storeInStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ_WITH_TRUE_LINK), 1);
1001
967
 
1002
968
  init(config);
1003
969
  setSubmoduleRegistry([id5System.id5IdSubmodule]);
@@ -1041,48 +1007,20 @@ describe('ID5 ID System', function () {
1041
1007
  }, {adUnits});
1042
1008
  });
1043
1009
 
1044
- it('should set nb=1 in cache when no stored nb value exists and cached ID', function (done) {
1045
- id5System.storeInLocalStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ), 1);
1046
- coreStorage.removeDataFromLocalStorage(id5System.nbCacheName(ID5_TEST_PARTNER_ID));
1047
-
1048
- init(config);
1049
- setSubmoduleRegistry([id5System.id5IdSubmodule]);
1050
- config.setConfig(getFetchLocalStorageConfig());
1051
-
1052
- requestBidsHook((adUnitConfig) => {
1053
- expect(id5System.getNbFromCache(ID5_TEST_PARTNER_ID)).is.eq(1);
1054
- done();
1055
- }, {adUnits});
1056
- });
1057
-
1058
- it('should increment nb in cache when stored nb value exists and cached ID', function (done) {
1059
- id5System.storeInLocalStorage(id5System.ID5_STORAGE_NAME, JSON.stringify(ID5_STORED_OBJ), 1);
1060
- id5System.storeNbInCache(ID5_TEST_PARTNER_ID, 1);
1061
-
1062
- init(config);
1063
- setSubmoduleRegistry([id5System.id5IdSubmodule]);
1064
- config.setConfig(getFetchLocalStorageConfig());
1065
-
1066
- requestBidsHook(() => {
1067
- expect(id5System.getNbFromCache(ID5_TEST_PARTNER_ID)).is.eq(2);
1068
- done();
1069
- }, {adUnits});
1070
- });
1071
-
1072
1010
  it('should call ID5 servers with signature and incremented nb post auction if refresh needed', function () {
1073
1011
  const xhrServerMock = new XhrServerMock(server);
1074
- const initialLocalStorageValue = JSON.stringify(ID5_STORED_OBJ);
1075
- id5System.storeInLocalStorage(id5System.ID5_STORAGE_NAME, initialLocalStorageValue, 1);
1076
- id5System.storeInLocalStorage(`${id5System.ID5_STORAGE_NAME}_last`, id5System.expDaysStr(-1), 1);
1012
+ let storedObject = ID5_STORED_OBJ;
1013
+ storedObject.nbPage = 1;
1014
+ const initialLocalStorageValue = JSON.stringify(storedObject);
1015
+ storeInStorage(id5System.ID5_STORAGE_NAME, initialLocalStorageValue, 1);
1016
+ storeInStorage(`${id5System.ID5_STORAGE_NAME}_last`, expDaysStr(-1), 1);
1077
1017
 
1078
- id5System.storeNbInCache(ID5_TEST_PARTNER_ID, 1);
1079
1018
  let id5Config = getFetchLocalStorageConfig();
1080
1019
  id5Config.userSync.userIds[0].storage.refreshInSeconds = 2;
1081
1020
  id5Config.userSync.auctionDelay = 0; // do not trigger callback before auction
1082
1021
  init(config);
1083
1022
  setSubmoduleRegistry([id5System.id5IdSubmodule]);
1084
1023
  config.setConfig(id5Config);
1085
-
1086
1024
  return new Promise((resolve) => {
1087
1025
  requestBidsHook(() => {
1088
1026
  resolve();
@@ -1095,18 +1033,7 @@ describe('ID5 ID System', function () {
1095
1033
  const requestBody = JSON.parse(request.requestBody);
1096
1034
  expect(requestBody.s).is.eq(ID5_STORED_SIGNATURE);
1097
1035
  expect(requestBody.nbPage).is.eq(2);
1098
- expect(id5System.getNbFromCache(ID5_TEST_PARTNER_ID)).is.eq(0);
1099
1036
  request.respond(200, HEADERS_CONTENT_TYPE_JSON, JSON.stringify(ID5_JSON_RESPONSE));
1100
-
1101
- return new Promise(function (resolve) {
1102
- (function waitForCondition() {
1103
- if (id5System.getFromLocalStorage(id5System.ID5_STORAGE_NAME) !== initialLocalStorageValue) return resolve();
1104
- setTimeout(waitForCondition, 30);
1105
- })();
1106
- });
1107
- }).then(() => {
1108
- expect(decodeURIComponent(id5System.getFromLocalStorage(id5System.ID5_STORAGE_NAME))).is.eq(JSON.stringify(ID5_JSON_RESPONSE));
1109
- expect(id5System.getNbFromCache(ID5_TEST_PARTNER_ID)).is.eq(0);
1110
1037
  });
1111
1038
  });
1112
1039
  });
@@ -4,6 +4,10 @@ import * as idImportlibrary from 'modules/idImportLibrary.js';
4
4
  import {getGlobal} from '../../../src/prebidGlobal.js';
5
5
  import {config} from 'src/config.js';
6
6
  import {hook} from '../../../src/hook.js';
7
+ import * as activities from '../../../src/activities/rules.js';
8
+ import { ACTIVITY_ENRICH_UFPD } from '../../../src/activities/activities.js';
9
+ import { CONF_DEFAULT_FULL_BODY_SCAN, CONF_DEFAULT_INPUT_SCAN } from '../../../modules/idImportLibrary.js';
10
+
7
11
  var expect = require('chai').expect;
8
12
 
9
13
  const mockMutationObserver = {
@@ -86,6 +90,16 @@ describe('IdImportLibrary Tests', function () {
86
90
  idImportlibrary.setConfig(config);
87
91
  expect(config.inputscan).to.be.equal(true);
88
92
  });
93
+ it('results when activity is not allowed', function () {
94
+ sandbox.stub(activities, 'isActivityAllowed').callsFake((activity) => {
95
+ return !(activity === ACTIVITY_ENRICH_UFPD);
96
+ });
97
+ let config = { 'url': 'URL', 'debounce': 0 };
98
+ idImportlibrary.setConfig(config);
99
+ sinon.assert.called(utils.logError);
100
+ expect(config.inputscan).to.be.not.equal(CONF_DEFAULT_INPUT_SCAN);
101
+ expect(config.fullscan).to.be.not.equal(CONF_DEFAULT_FULL_BODY_SCAN);
102
+ });
89
103
  });
90
104
  describe('Test with email is found', function () {
91
105
  let mutationObserverStub;
@@ -856,7 +856,8 @@ describe('IndexexchangeAdapter', function () {
856
856
  source: 'identityinc.com',
857
857
  uids: [
858
858
  {
859
- id: 'identityid'
859
+ id: 'identityid',
860
+ atype: 1
860
861
  }
861
862
  ]
862
863
  }
@@ -1383,8 +1384,14 @@ describe('IndexexchangeAdapter', function () {
1383
1384
 
1384
1385
  it('identity data in impression should have correct format and value (single identity partner)', function () {
1385
1386
  const impression = payload.user.eids;
1387
+ expect(impression).to.be.an('array');
1388
+ expect(impression).to.have.lengthOf(1);
1386
1389
  expect(impression[0].source).to.equal(testCopy.IdentityIp.data.source);
1390
+ expect(impression[0].uids).to.be.an('array');
1391
+ expect(impression[0].uids).to.have.lengthOf(1);
1387
1392
  expect(impression[0].uids[0].id).to.equal(testCopy.IdentityIp.data.uids[0].id);
1393
+ expect(impression[0].uids[0].atype).to.exist;
1394
+ expect(impression[0].uids[0].atype).to.equal(testCopy.IdentityIp.data.uids[0].atype);
1388
1395
  });
1389
1396
  });
1390
1397
 
@@ -23,83 +23,86 @@ describe('Mobian RTD Submodule', function () {
23
23
  ajaxStub.restore();
24
24
  });
25
25
 
26
- it('should return no_risk when server responds with garm_no_risk', function () {
26
+ it('should return risk level when server responds with garm_risk', function () {
27
27
  ajaxStub = sinon.stub(ajax, 'ajaxBuilder').returns(function(url, callbacks) {
28
- callbacks.success({
29
- garm_no_risk: true,
30
- garm_low_risk: false,
31
- garm_medium_risk: false,
32
- garm_high_risk: false
33
- });
28
+ callbacks.success(JSON.stringify({
29
+ garm_risk: 'low',
30
+ sentiment_positive: true,
31
+ emotion_joy: true
32
+ }));
34
33
  });
35
34
 
36
35
  return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
37
- expect(risk).to.have.property('mobianGarmRisk');
38
- expect(risk['mobianGarmRisk']).to.equal('no_risk');
36
+ expect(risk).to.deep.equal({
37
+ risk: 'low',
38
+ contentCategories: [],
39
+ sentiment: 'positive',
40
+ emotions: ['joy']
41
+ });
39
42
  expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
40
43
  });
41
44
  });
42
45
 
43
- it('should return low_risk when server responds with garm_no_risk', function () {
46
+ it('should handle response with GARM content categories, sentiment, and emotions', function () {
44
47
  ajaxStub = sinon.stub(ajax, 'ajaxBuilder').returns(function(url, callbacks) {
45
- callbacks.success({
46
- garm_no_risk: false,
47
- garm_low_risk: true,
48
- garm_medium_risk: false,
49
- garm_high_risk: false
50
- });
48
+ callbacks.success(JSON.stringify({
49
+ garm_risk: 'medium',
50
+ garm_content_category_arms: true,
51
+ garm_content_category_crime: true,
52
+ sentiment_negative: true,
53
+ emotion_anger: true,
54
+ emotion_fear: true
55
+ }));
51
56
  });
52
57
 
53
58
  return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
54
- expect(risk).to.have.property('mobianGarmRisk');
55
- expect(risk['mobianGarmRisk']).to.equal('low_risk');
59
+ expect(risk).to.deep.equal({
60
+ risk: 'medium',
61
+ contentCategories: ['arms', 'crime'],
62
+ sentiment: 'negative',
63
+ emotions: ['anger', 'fear']
64
+ });
56
65
  expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
57
66
  });
58
67
  });
59
68
 
60
- it('should return medium_risk when server responds with garm_medium_risk', function () {
69
+ it('should return unknown risk when garm_risk is not present', function () {
61
70
  ajaxStub = sinon.stub(ajax, 'ajaxBuilder').returns(function(url, callbacks) {
62
- callbacks.success({
63
- garm_no_risk: false,
64
- garm_low_risk: false,
65
- garm_medium_risk: true,
66
- garm_high_risk: false
67
- });
71
+ callbacks.success(JSON.stringify({
72
+ sentiment_neutral: true
73
+ }));
68
74
  });
69
75
 
70
76
  return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
71
- expect(risk).to.have.property('mobianGarmRisk');
72
- expect(risk['mobianGarmRisk']).to.equal('medium_risk');
77
+ expect(risk).to.deep.equal({
78
+ risk: 'unknown',
79
+ contentCategories: [],
80
+ sentiment: 'neutral',
81
+ emotions: []
82
+ });
73
83
  expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
74
84
  });
75
85
  });
76
86
 
77
- it('should return high_risk when server responds with garm_high_risk', function () {
87
+ it('should return empty object when server response is not valid JSON', function () {
78
88
  ajaxStub = sinon.stub(ajax, 'ajaxBuilder').returns(function(url, callbacks) {
79
- callbacks.success({
80
- garm_no_risk: false,
81
- garm_low_risk: false,
82
- garm_medium_risk: false,
83
- garm_high_risk: true
84
- });
89
+ callbacks.success('unexpected output not even of the right type');
85
90
  });
86
-
91
+ const originalConfig = JSON.parse(JSON.stringify(bidReqConfig));
87
92
  return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
88
- expect(risk).to.have.property('mobianGarmRisk');
89
- expect(risk['mobianGarmRisk']).to.equal('high_risk');
90
- expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
93
+ expect(risk).to.deep.equal({});
94
+ // Check that bidReqConfig hasn't been modified
95
+ expect(bidReqConfig).to.deep.equal(originalConfig);
91
96
  });
92
97
  });
93
98
 
94
- it('should return unknown when server response is not of the expected shape', function () {
99
+ it('should handle error response', function () {
95
100
  ajaxStub = sinon.stub(ajax, 'ajaxBuilder').returns(function(url, callbacks) {
96
- callbacks.success('unexpected output not even of the right type');
101
+ callbacks.error();
97
102
  });
98
103
 
99
104
  return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
100
- expect(risk).to.have.property('mobianGarmRisk');
101
- expect(risk['mobianGarmRisk']).to.equal('unknown');
102
- expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
105
+ expect(risk).to.deep.equal({});
103
106
  });
104
107
  });
105
108
  });
@@ -1025,7 +1025,7 @@ describe('OpenxRtbAdapter', function () {
1025
1025
  // enrich bid request with userId key/value
1026
1026
 
1027
1027
  const request = spec.buildRequests(bidRequestsWithUserId, mockBidderRequest);
1028
- expect(request[0].data.user.ext.eids).to.equal(userIdAsEids);
1028
+ expect(request[0].data.user.ext.eids).to.eql(userIdAsEids);
1029
1029
  });
1030
1030
 
1031
1031
  it(`when no user ids are available, it should not send any extended ids`, function () {
@@ -0,0 +1,103 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from 'modules/ownadxBidAdapter.js';
3
+
4
+ describe('ownadx', function () {
5
+ const METHOD = 'POST';
6
+ const URL = 'https://pbs-js.prebid-ownadx.com/publisher/prebid/9/1231?token=3f2941af4f7e446f9a19ca6045f8cff4';
7
+
8
+ const bidRequest = {
9
+ bidder: 'ownadx',
10
+ params: {
11
+ tokenId: '3f2941af4f7e446f9a19ca6045f8cff4',
12
+ sspId: '1231',
13
+ seatId: '9'
14
+ },
15
+ mediaTypes: {
16
+ banner: {
17
+ sizes: [[300, 250], [300, 600]]
18
+ }
19
+ },
20
+ sizes: [
21
+ [300, 250],
22
+ [300, 600]
23
+ ],
24
+ bidId: 'bid-id-123456',
25
+ adUnitCode: 'ad-unit-code-1',
26
+ bidderRequestId: 'bidder-request-id-123456',
27
+ auctionId: 'auction-id-123456',
28
+ transactionId: 'transaction-id-123456'
29
+ };
30
+
31
+ describe('isBidRequestValid', function () {
32
+ it('should return true where required params found', function () {
33
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
34
+ });
35
+ });
36
+
37
+ describe('buildRequests', function () {
38
+ let bidderRequest = {
39
+ refererInfo: {
40
+ page: 'https://www.test.com',
41
+ reachedTop: true,
42
+ isAmp: false,
43
+ numIframes: 0,
44
+ stack: [
45
+ 'https://www.test.com'
46
+ ],
47
+ canonicalUrl: null
48
+ }
49
+ };
50
+
51
+ it('should build correct POST request for banner bid', function () {
52
+ const request = spec.buildRequests([bidRequest], bidderRequest)[0];
53
+ expect(request).to.be.an('object');
54
+ expect(request.method).to.equal('POST');
55
+ expect(request.url).to.equal('https://pbs-js.prebid-ownadx.com/publisher/prebid/9/1231?token=3f2941af4f7e446f9a19ca6045f8cff4');
56
+ const payload = request.data;
57
+ expect(payload).to.be.an('object');
58
+ expect(payload.sizes).to.be.an('array');
59
+ expect(payload.slotBidId).to.be.a('string');
60
+ expect(payload.PageUrl).to.be.a('string');
61
+ expect(payload.mediaChannel).to.be.a('number');
62
+ });
63
+ });
64
+
65
+ describe('interpretResponse', function () {
66
+ let serverResponse = {
67
+ body: {
68
+ tokenId: '3f2941af4f7e446f9a19ca6045f8cff4',
69
+ bid: 'BID-XXXX-XXXX',
70
+ width: '300',
71
+ height: '250',
72
+ cpm: '0.7',
73
+ adm: '<html><h1>Ad from OwnAdX</h1></html>',
74
+ slotBidId: 'bid-id-123456',
75
+ adType: '1',
76
+ statusText: 'Success'
77
+ }
78
+ };
79
+
80
+ let expectedResponse = [{
81
+ token: '3f2941af4f7e446f9a19ca6045f8cff4',
82
+ requestId: 'bid-id-123456',
83
+ cpm: '0.7',
84
+ currency: 'USD',
85
+ aType: '1',
86
+ netRevenue: false,
87
+ width: '300',
88
+ height: '250',
89
+ creativeId: 0,
90
+ ttl: 300,
91
+ ad: '<html><h1>Ad from OwnAdX</h1></html>',
92
+ meta: {
93
+ mediaType: 'banner',
94
+ advertiserDomains: []
95
+ }
96
+ }];
97
+
98
+ it('should correctly interpret valid banner response', function () {
99
+ let result = spec.interpretResponse(serverResponse);
100
+ expect(result).to.deep.equal(expectedResponse);
101
+ });
102
+ });
103
+ });
@@ -2974,6 +2974,24 @@ describe('PubMatic adapter', function () {
2974
2974
  expect(data.device).to.include.any.keys('connectiontype');
2975
2975
  }
2976
2976
  });
2977
+
2978
+ it('should send imp.pmp in request if pmp json is present in adUnit ortb2Imp object', function () {
2979
+ let originalBidRequests = utils.deepClone(bidRequests);
2980
+ originalBidRequests[0].ortb2Imp.pmp = {
2981
+ 'private_auction': 0,
2982
+ 'deals': [{ 'id': '5678' }]
2983
+ }
2984
+ const bidRequest = spec.buildRequests(originalBidRequests);
2985
+ let data = JSON.parse(bidRequest.data);
2986
+ expect(data.imp[0].pmp).to.exist.and.to.be.an('object');
2987
+ })
2988
+
2989
+ it('should not send imp.pmp in request if pmp json is not present in adUnit ortb2Imp object', function () {
2990
+ let originalBidRequests = utils.deepClone(bidRequests);
2991
+ const bidRequest = spec.buildRequests(originalBidRequests);
2992
+ let data = JSON.parse(bidRequest.data);
2993
+ expect(data.imp[0].pmp).to.deep.equal(undefined);
2994
+ })
2977
2995
  });
2978
2996
 
2979
2997
  it('Request params dctr check', function () {