prebid.js 6.6.0 → 6.10.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 (271) hide show
  1. package/.eslintrc.js +8 -1
  2. package/allowedModules.js +4 -7
  3. package/integrationExamples/gpt/amp/creative.html +11 -33
  4. package/integrationExamples/gpt/{haloRtdProvider_example.html → hadronRtdProvider_example.html} +9 -9
  5. package/integrationExamples/gpt/idImportLibrary_example.html +2 -2
  6. package/integrationExamples/gpt/userId_example.html +2 -2
  7. package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
  8. package/integrationExamples/gpt/x-domain/creative.html +63 -29
  9. package/modules/.submodules.json +3 -0
  10. package/modules/adagioBidAdapter.js +1 -9
  11. package/modules/adagioBidAdapter.md +1 -1
  12. package/modules/adbookpspBidAdapter.js +29 -12
  13. package/modules/adhashBidAdapter.js +4 -4
  14. package/modules/adkernelBidAdapter.js +2 -2
  15. package/modules/adlooxAnalyticsAdapter.js +1 -1
  16. package/modules/adlooxRtdProvider.js +1 -1
  17. package/modules/adnowBidAdapter.js +1 -1
  18. package/modules/adnuntiusRtdProvider.js +96 -0
  19. package/modules/adnuntiusRtdProvider.md +41 -0
  20. package/modules/adomikAnalyticsAdapter.js +2 -2
  21. package/modules/adotBidAdapter.js +1 -1
  22. package/modules/adpod.js +14 -17
  23. package/modules/adrelevantisBidAdapter.js +2 -2
  24. package/modules/adtargetBidAdapter.js +1 -1
  25. package/modules/adtelligentBidAdapter.js +1 -1
  26. package/modules/advangelistsBidAdapter.js +2 -2
  27. package/modules/adxpremiumAnalyticsAdapter.js +1 -1
  28. package/modules/adyoulikeBidAdapter.js +1 -1
  29. package/modules/afpBidAdapter.js +1 -1
  30. package/modules/appnexusBidAdapter.js +16 -4
  31. package/modules/asealBidAdapter.js +58 -0
  32. package/modules/asealBidAdapter.md +52 -0
  33. package/modules/beachfrontBidAdapter.js +2 -2
  34. package/modules/betweenBidAdapter.js +1 -1
  35. package/modules/bidViewability.js +1 -1
  36. package/modules/bluebillywigBidAdapter.js +1 -1
  37. package/modules/brandmetricsRtdProvider.js +168 -0
  38. package/modules/brandmetricsRtdProvider.md +40 -0
  39. package/modules/bridgewellBidAdapter.js +1 -1
  40. package/modules/browsiRtdProvider.js +2 -2
  41. package/modules/cleanmedianetBidAdapter.js +1 -1
  42. package/modules/colossussspBidAdapter.js +12 -8
  43. package/modules/colossussspBidAdapter.md +15 -1
  44. package/modules/compassBidAdapter.js +1 -1
  45. package/modules/connectIdSystem.js +1 -1
  46. package/modules/consentManagement.js +2 -3
  47. package/modules/consumableBidAdapter.md +1 -1
  48. package/modules/conversantBidAdapter.js +7 -0
  49. package/modules/craftBidAdapter.js +2 -2
  50. package/modules/criteoBidAdapter.js +10 -1
  51. package/modules/currency.js +27 -5
  52. package/modules/cwireBidAdapter.js +1 -1
  53. package/modules/dailyhuntBidAdapter.js +1 -1
  54. package/modules/dchain.js +1 -1
  55. package/modules/displayioBidAdapter.js +157 -0
  56. package/modules/displayioBidAdapter.md +148 -0
  57. package/modules/dspxBidAdapter.js +69 -29
  58. package/modules/dspxBidAdapter.md +2 -1
  59. package/modules/e_volutionBidAdapter.js +158 -0
  60. package/modules/emx_digitalBidAdapter.js +2 -2
  61. package/modules/fluctBidAdapter.js +0 -1
  62. package/modules/gamoshiBidAdapter.js +1 -1
  63. package/modules/gdprEnforcement.js +2 -2
  64. package/modules/glomexBidAdapter.js +1 -1
  65. package/modules/gnetBidAdapter.js +3 -3
  66. package/modules/gnetBidAdapter.md +4 -4
  67. package/modules/goldbachBidAdapter.js +2 -2
  68. package/modules/gptPreAuction.js +1 -1
  69. package/modules/gridBidAdapter.js +15 -1
  70. package/modules/gumgumBidAdapter.js +57 -43
  71. package/modules/hadronIdSystem.js +96 -0
  72. package/modules/hadronIdSystem.md +35 -0
  73. package/modules/hadronRtdProvider.js +254 -0
  74. package/modules/hadronRtdProvider.md +126 -0
  75. package/modules/haloIdSystem.md +4 -35
  76. package/modules/haloRtdProvider.md +3 -126
  77. package/modules/hybridBidAdapter.js +1 -1
  78. package/modules/improvedigitalBidAdapter.js +6 -1
  79. package/modules/insticatorBidAdapter.js +1 -1
  80. package/modules/interactiveOffersBidAdapter.js +9 -6
  81. package/modules/intersectionRtdProvider.js +1 -1
  82. package/modules/ixBidAdapter.js +2 -2
  83. package/modules/jwplayerRtdProvider.js +72 -7
  84. package/modules/jwplayerRtdProvider.md +27 -11
  85. package/modules/kargoBidAdapter.js +2 -2
  86. package/modules/livewrappedBidAdapter.js +1 -1
  87. package/modules/lunamediahbBidAdapter.js +32 -4
  88. package/modules/malltvBidAdapter.js +7 -3
  89. package/modules/malltvBidAdapter.md +64 -51
  90. package/modules/mass.js +3 -5
  91. package/modules/mediakeysBidAdapter.js +2 -2
  92. package/modules/medianetAnalyticsAdapter.js +2 -2
  93. package/modules/medianetRtdProvider.js +1 -1
  94. package/modules/mediasquareBidAdapter.js +1 -0
  95. package/modules/nextMillenniumBidAdapter.js +1 -0
  96. package/modules/nextrollBidAdapter.js +1 -1
  97. package/modules/oguryBidAdapter.js +7 -14
  98. package/modules/onetagBidAdapter.js +1 -1
  99. package/modules/openwebBidAdapter.js +1 -1
  100. package/modules/openxAnalyticsAdapter.js +2 -2
  101. package/modules/openxBidAdapter.js +1 -1
  102. package/modules/parrableIdSystem.js +1 -1
  103. package/modules/permutiveRtdProvider.js +1 -1
  104. package/modules/pilotxBidAdapter.js +147 -0
  105. package/modules/pilotxBidAdapter.md +50 -0
  106. package/modules/pixfutureBidAdapter.js +2 -2
  107. package/modules/prebidServerBidAdapter/index.js +63 -41
  108. package/modules/priceFloors.js +15 -14
  109. package/modules/pubmaticBidAdapter.js +1 -1
  110. package/modules/quantcastBidAdapter.js +1 -1
  111. package/modules/reconciliationRtdProvider.js +1 -1
  112. package/modules/richaudienceBidAdapter.js +7 -2
  113. package/modules/riseBidAdapter.js +17 -6
  114. package/modules/roxotAnalyticsAdapter.js +1 -1
  115. package/modules/rtbhouseBidAdapter.js +1 -1
  116. package/modules/rtdModule/index.js +9 -11
  117. package/modules/rubiconAnalyticsAdapter.js +8 -2
  118. package/modules/rubiconBidAdapter.js +1 -1
  119. package/modules/saambaaBidAdapter.js +420 -420
  120. package/modules/seedingAllianceBidAdapter.js +3 -3
  121. package/modules/sharethroughBidAdapter.js +12 -17
  122. package/modules/sigmoidAnalyticsAdapter.js +1 -1
  123. package/modules/sirdataRtdProvider.js +1 -1
  124. package/modules/sizeMappingV2.js +2 -9
  125. package/modules/smarticoBidAdapter.js +1 -1
  126. package/modules/sortableAnalyticsAdapter.js +5 -4
  127. package/modules/sovrnAnalyticsAdapter.js +2 -2
  128. package/modules/sovrnBidAdapter.js +93 -18
  129. package/modules/sovrnBidAdapter.md +80 -2
  130. package/modules/sspBCBidAdapter.js +54 -21
  131. package/modules/synacormediaBidAdapter.js +32 -11
  132. package/modules/targetVideoBidAdapter.js +1 -1
  133. package/modules/telariaBidAdapter.js +22 -29
  134. package/modules/trustpidSystem.js +197 -0
  135. package/modules/trustpidSystem.md +45 -0
  136. package/modules/undertoneBidAdapter.js +17 -1
  137. package/modules/userId/eids.js +16 -1
  138. package/modules/userId/eids.md +10 -2
  139. package/modules/userId/index.js +2 -2
  140. package/modules/userId/userId.md +17 -2
  141. package/modules/ventesBidAdapter.js +1 -1
  142. package/modules/verizonMediaIdSystem.js +1 -1
  143. package/modules/vibrantmediaBidAdapter.js +220 -0
  144. package/modules/vibrantmediaBidAdapter.md +92 -0
  145. package/modules/viewability.js +177 -0
  146. package/modules/viewability.md +87 -0
  147. package/modules/viewdeosDXBidAdapter.js +1 -1
  148. package/modules/voxBidAdapter.js +1 -1
  149. package/modules/waardexBidAdapter.js +1 -1
  150. package/modules/weboramaRtdProvider.js +264 -34
  151. package/modules/weboramaRtdProvider.md +110 -40
  152. package/modules/widespaceBidAdapter.js +2 -2
  153. package/modules/winrBidAdapter.js +7 -7
  154. package/modules/yahoosspBidAdapter.js +3 -1
  155. package/modules/yieldlabBidAdapter.js +1 -1
  156. package/modules/yieldmoBidAdapter.js +2 -2
  157. package/modules/yieldoneBidAdapter.js +6 -0
  158. package/modules/yuktamediaAnalyticsAdapter.js +1 -1
  159. package/package.json +3 -1
  160. package/plugins/poly/arrayFrom.js +3 -0
  161. package/plugins/poly/find.js +3 -0
  162. package/plugins/poly/findIndex.js +3 -0
  163. package/plugins/poly/includes.js +3 -0
  164. package/plugins/poly/package.json +8 -0
  165. package/src/Renderer.js +1 -1
  166. package/src/adRendering.js +38 -0
  167. package/src/adapterManager.js +33 -28
  168. package/src/adapters/bidderFactory.js +13 -11
  169. package/src/adloader.js +3 -2
  170. package/src/auction.js +140 -117
  171. package/src/auctionIndex.js +85 -0
  172. package/src/auctionManager.js +4 -1
  173. package/src/bidderSettings.js +69 -0
  174. package/src/bidfactory.js +18 -6
  175. package/src/config.js +3 -4
  176. package/src/cpmBucketManager.js +1 -1
  177. package/src/native.js +30 -22
  178. package/src/prebid.js +4 -20
  179. package/src/secureCreatives.js +133 -49
  180. package/src/sizeMapping.js +1 -1
  181. package/src/storageManager.js +1 -1
  182. package/src/targeting.js +13 -4
  183. package/src/userSync.js +1 -1
  184. package/src/utils.js +16 -19
  185. package/src/video.js +11 -12
  186. package/src/videoCache.js +10 -9
  187. package/test/fixtures/fixtures.js +2 -1
  188. package/test/helpers/indexStub.js +28 -0
  189. package/test/helpers/syncPromise.js +71 -0
  190. package/test/spec/auctionmanager_spec.js +269 -90
  191. package/test/spec/config_spec.js +24 -1
  192. package/test/spec/e2e/longform/basic_w_bidderSettings.spec.js +1 -1
  193. package/test/spec/e2e/longform/basic_w_custom_adserver_translation.spec.js +1 -1
  194. package/test/spec/e2e/longform/basic_w_priceGran.spec.js +1 -1
  195. package/test/spec/e2e/longform/basic_w_requireExactDuration.spec.js +1 -1
  196. package/test/spec/e2e/longform/basic_wo_brandCategoryExclusion.spec.js +1 -1
  197. package/test/spec/e2e/longform/basic_wo_requireExactDuration.spec.js +1 -1
  198. package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
  199. package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
  200. package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
  201. package/test/spec/modules/adnuntiusRtdProvider_spec.js +145 -0
  202. package/test/spec/modules/adpod_spec.js +91 -156
  203. package/test/spec/modules/afpBidAdapter_spec.js +1 -1
  204. package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
  205. package/test/spec/modules/asealBidAdapter_spec.js +144 -0
  206. package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
  207. package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
  208. package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
  209. package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
  210. package/test/spec/modules/currency_spec.js +36 -15
  211. package/test/spec/modules/deepintentDpesIdsystem_spec.js +1 -1
  212. package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
  213. package/test/spec/modules/dspxBidAdapter_spec.js +20 -15
  214. package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
  215. package/test/spec/modules/eids_spec.js +2 -2
  216. package/test/spec/modules/eplanningAnalyticsAdapter_spec.js +1 -1
  217. package/test/spec/modules/fintezaAnalyticsAdapter_spec.js +1 -1
  218. package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
  219. package/test/spec/modules/gridBidAdapter_spec.js +18 -0
  220. package/test/spec/modules/gumgumBidAdapter_spec.js +49 -3
  221. package/test/spec/modules/hadronIdSystem_spec.js +57 -0
  222. package/test/spec/modules/hadronRtdProvider_spec.js +762 -0
  223. package/test/spec/modules/idxIdSystem_spec.js +1 -1
  224. package/test/spec/modules/improvedigitalBidAdapter_spec.js +19 -0
  225. package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
  226. package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
  227. package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
  228. package/test/spec/modules/mass_spec.js +2 -14
  229. package/test/spec/modules/mediakeysBidAdapter_spec.js +1 -1
  230. package/test/spec/modules/multibid_spec.js +1 -1
  231. package/test/spec/modules/oguryBidAdapter_spec.js +63 -5
  232. package/test/spec/modules/onetagBidAdapter_spec.js +1 -1
  233. package/test/spec/modules/openxAnalyticsAdapter_spec.js +1 -1
  234. package/test/spec/modules/parrableIdSystem_spec.js +1 -1
  235. package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
  236. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -6
  237. package/test/spec/modules/priceFloors_spec.js +37 -24
  238. package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
  239. package/test/spec/modules/realTimeDataModule_spec.js +51 -2
  240. package/test/spec/modules/riseBidAdapter_spec.js +30 -4
  241. package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +61 -1
  242. package/test/spec/modules/rubiconBidAdapter_spec.js +1 -1
  243. package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
  244. package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
  245. package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
  246. package/test/spec/modules/sspBCBidAdapter_spec.js +7 -7
  247. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +1 -1
  248. package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
  249. package/test/spec/modules/telariaBidAdapter_spec.js +1 -3
  250. package/test/spec/modules/trustpidSystem_spec.js +232 -0
  251. package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
  252. package/test/spec/modules/userId_spec.js +40 -40
  253. package/test/spec/modules/vibrantmediaBidAdapter_spec.js +1237 -0
  254. package/test/spec/modules/viewability_spec.js +280 -0
  255. package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
  256. package/test/spec/modules/widespaceBidAdapter_spec.js +1 -1
  257. package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
  258. package/test/spec/modules/yieldoneBidAdapter_spec.js +33 -0
  259. package/test/spec/modules/zeotapIdPlusIdSystem_spec.js +1 -1
  260. package/test/spec/native_spec.js +62 -40
  261. package/test/spec/sizeMapping_spec.js +1 -1
  262. package/test/spec/unit/core/adapterManager_spec.js +24 -2
  263. package/test/spec/unit/core/auctionIndex_spec.js +129 -0
  264. package/test/spec/unit/core/bidderFactory_spec.js +65 -12
  265. package/test/spec/unit/core/bidderSettings_spec.js +123 -0
  266. package/test/spec/unit/core/targeting_spec.js +93 -0
  267. package/test/spec/unit/pbjs_api_spec.js +81 -43
  268. package/test/spec/unit/secureCreatives_spec.js +143 -24
  269. package/test/spec/videoCache_spec.js +18 -19
  270. package/test/spec/video_spec.js +51 -61
  271. package/webpack.conf.js +1 -1
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- import { getAdUnitSizes, logWarn, deepSetValue } from '../src/utils.js';
3
+ import { getAdUnitSizes, logWarn, deepSetValue, isFn, isPlainObject } from '../src/utils.js';
4
4
  import { registerBidder } from '../src/adapters/bidderFactory.js';
5
5
  import { BANNER, VIDEO } from '../src/mediaTypes.js';
6
- import includes from 'core-js-pure/features/array/includes.js';
6
+ import includes from 'prebidjs-polyfill/includes.js';
7
7
  import {config} from '../src/config.js';
8
8
 
9
9
  const BID_SCHEME = 'https://';
@@ -67,11 +67,7 @@ export const spec = {
67
67
  } else {
68
68
  seatId = bid.params.seatId;
69
69
  }
70
- const tagIdOrplacementId = bid.params.tagId || bid.params.placementId;
71
- const bidFloor = bid.params.bidfloor ? parseFloat(bid.params.bidfloor) : null;
72
- if (isNaN(bidFloor)) {
73
- logWarn(`Synacormedia: there is an invalid bid floor: ${bid.params.bidfloor}`);
74
- }
70
+ const tagIdOrPlacementId = bid.params.tagId || bid.params.placementId;
75
71
  let pos = parseInt(bid.params.pos, 10);
76
72
  if (isNaN(pos)) {
77
73
  logWarn(`Synacormedia: there is an invalid POS: ${bid.params.pos}`);
@@ -83,9 +79,9 @@ export const spec = {
83
79
 
84
80
  let imps = [];
85
81
  if (videoOrBannerKey === 'banner') {
86
- imps = this.buildBannerImpressions(adSizes, bid, tagIdOrplacementId, pos, bidFloor, videoOrBannerKey);
82
+ imps = this.buildBannerImpressions(adSizes, bid, tagIdOrPlacementId, pos, videoOrBannerKey);
87
83
  } else if (videoOrBannerKey === 'video') {
88
- imps = this.buildVideoImpressions(adSizes, bid, tagIdOrplacementId, pos, bidFloor, videoOrBannerKey);
84
+ imps = this.buildVideoImpressions(adSizes, bid, tagIdOrPlacementId, pos, videoOrBannerKey);
89
85
  }
90
86
  if (imps.length > 0) {
91
87
  imps.forEach(i => openRtbBidRequest.imp.push(i));
@@ -128,7 +124,7 @@ export const spec = {
128
124
  return eids;
129
125
  },
130
126
 
131
- buildBannerImpressions: function (adSizes, bid, tagIdOrPlacementId, pos, bidFloor, videoOrBannerKey) {
127
+ buildBannerImpressions: function (adSizes, bid, tagIdOrPlacementId, pos, videoOrBannerKey) {
132
128
  let format = [];
133
129
  let imps = [];
134
130
  adSizes.forEach((size, i) => {
@@ -151,6 +147,10 @@ export const spec = {
151
147
  },
152
148
  tagid: tagIdOrPlacementId,
153
149
  };
150
+ const bidFloor = getBidFloor(bid, 'banner', '*');
151
+ if (isNaN(bidFloor)) {
152
+ logWarn(`Synacormedia: there is an invalid bid floor: ${bid.params.bidfloor}`);
153
+ }
154
154
  if (bidFloor !== null && !isNaN(bidFloor)) {
155
155
  imp.bidfloor = bidFloor;
156
156
  }
@@ -159,7 +159,7 @@ export const spec = {
159
159
  return imps;
160
160
  },
161
161
 
162
- buildVideoImpressions: function(adSizes, bid, tagIdOrPlacementId, pos, bidFloor, videoOrBannerKey) {
162
+ buildVideoImpressions: function(adSizes, bid, tagIdOrPlacementId, pos, videoOrBannerKey) {
163
163
  let imps = [];
164
164
  adSizes.forEach((size, i) => {
165
165
  if (!size || size.length != 2) {
@@ -171,6 +171,11 @@ export const spec = {
171
171
  id: `${videoOrBannerKey.substring(0, 1)}${bid.bidId}-${size0}x${size1}`,
172
172
  tagid: tagIdOrPlacementId
173
173
  };
174
+ const bidFloor = getBidFloor(bid, 'video', size);
175
+ if (isNaN(bidFloor)) {
176
+ logWarn(`Synacormedia: there is an invalid bid floor: ${bid.params.bidfloor}`);
177
+ }
178
+
174
179
  if (bidFloor !== null && !isNaN(bidFloor)) {
175
180
  imp.bidfloor = bidFloor;
176
181
  }
@@ -287,4 +292,20 @@ export const spec = {
287
292
  }
288
293
  };
289
294
 
295
+ function getBidFloor(bid, mediaType, size) {
296
+ if (!isFn(bid.getFloor)) {
297
+ return bid.params.bidfloor ? parseFloat(bid.params.bidfloor) : null;
298
+ }
299
+ let floor = bid.getFloor({
300
+ currency: 'USD',
301
+ mediaType,
302
+ size
303
+ });
304
+
305
+ if (isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'USD') {
306
+ return floor.floor;
307
+ }
308
+ return null;
309
+ }
310
+
290
311
  registerBidder(spec);
@@ -1,4 +1,4 @@
1
- import find from 'core-js-pure/features/array/find.js';
1
+ import find from 'prebidjs-polyfill/find.js';
2
2
  import { getBidRequest } from '../src/utils.js';
3
3
  import { BANNER, VIDEO } from '../src/mediaTypes.js';
4
4
  import { registerBidder } from '../src/adapters/bidderFactory.js';
@@ -1,8 +1,6 @@
1
1
  import { logError, isEmpty, deepAccess, triggerPixel, logWarn, isArray } from '../src/utils.js';
2
- import {createBid as createBidFactory} from '../src/bidfactory.js';
3
2
  import {registerBidder} from '../src/adapters/bidderFactory.js';
4
3
  import {VIDEO} from '../src/mediaTypes.js';
5
- import CONSTANTS from '../src/constants.json';
6
4
 
7
5
  const BIDDER_CODE = 'telaria';
8
6
  const DOMAIN = 'tremorhub.com';
@@ -86,7 +84,9 @@ export const spec = {
86
84
  logError(errorMessage);
87
85
  } else if (!isEmpty(bidResult.seatbid)) {
88
86
  bidResult.seatbid[0].bid.forEach(tag => {
89
- bids.push(createBid(CONSTANTS.STATUS.GOOD, bidderRequest, tag, width, height, BIDDER_CODE));
87
+ if (tag) {
88
+ bids.push(createBid(bidderRequest, tag, width, height));
89
+ }
90
90
  });
91
91
  }
92
92
 
@@ -253,38 +253,31 @@ function generateUrl(bid, bidderRequest) {
253
253
  }
254
254
 
255
255
  /**
256
- * Create and return a bid object based on status and tag
257
- * @param status
256
+ * Create and return a bid response
258
257
  * @param reqBid
259
258
  * @param response
260
259
  * @param width
261
260
  * @param height
262
- * @param bidderCode
263
261
  */
264
- function createBid(status, reqBid, response, width, height, bidderCode) {
265
- let bid = createBidFactory(status, reqBid);
266
-
262
+ function createBid(reqBid, response, width, height) {
267
263
  // TTL 5 mins by default, future support for extended imp wait time
268
- if (response) {
269
- Object.assign(bid, {
270
- requestId: reqBid.bidId,
271
- cpm: response.price,
272
- creativeId: response.crid || '-1',
273
- vastXml: response.adm,
274
- vastUrl: reqBid.vastUrl,
275
- mediaType: 'video',
276
- width: width,
277
- height: height,
278
- bidderCode: bidderCode,
279
- currency: 'USD',
280
- netRevenue: true,
281
- ttl: 300,
282
- ad: response.adm
283
- });
284
- }
285
-
286
- bid.meta = bid.meta || {};
287
- if (response && response.adomain && response.adomain.length > 0) {
264
+ const bid = {
265
+ requestId: reqBid.bidId,
266
+ cpm: response.price,
267
+ creativeId: response.crid || '-1',
268
+ vastXml: response.adm,
269
+ vastUrl: reqBid.vastUrl,
270
+ mediaType: 'video',
271
+ width: width,
272
+ height: height,
273
+ currency: 'USD',
274
+ netRevenue: true,
275
+ ttl: 300,
276
+ ad: response.adm,
277
+ meta: {}
278
+ };
279
+
280
+ if (response.adomain && response.adomain.length > 0) {
288
281
  bid.meta.advertiserDomains = response.adomain;
289
282
  }
290
283
 
@@ -0,0 +1,197 @@
1
+ /**
2
+ * This module adds TrustPid provided by Vodafone Sales and Services Limited to the User ID module
3
+ * The {@link module:modules/userId} module is required
4
+ * @module modules/trustpidSystem
5
+ * @requires module:modules/userId
6
+ */
7
+ import { logInfo, logError } from '../src/utils.js';
8
+ import { submodule } from '../src/hook.js';
9
+ import { getStorageManager } from '../src/storageManager.js';
10
+
11
+ const MODULE_NAME = 'trustpid';
12
+ const LOG_PREFIX = 'Trustpid module'
13
+ let mnoAcronym = '';
14
+ let mnoDomain = '';
15
+
16
+ export const storage = getStorageManager(null, MODULE_NAME);
17
+
18
+ /**
19
+ * Handle an event for an iframe.
20
+ * Takes the body.url parameter from event and returns the string domain.
21
+ * i.e.: "fc.vodafone.de"
22
+ * @param event
23
+ */
24
+ function messageHandler(event) {
25
+ let msg;
26
+ try {
27
+ if (event && event.data && typeof event.data === 'string' && event.data) {
28
+ msg = JSON.parse(event.data);
29
+ if (msg.msgType === 'MNOSELECTOR' && msg.body && msg.body.url) {
30
+ let URL = msg.body.url.split('//');
31
+ let domainURL = URL[1].split('/');
32
+ mnoDomain = domainURL[0];
33
+ logInfo(`${LOG_PREFIX}: Message handler set domain to ${mnoDomain}`);
34
+ getDomainAcronym(mnoDomain);
35
+ }
36
+ }
37
+ } catch (e) {
38
+ logError(e);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Properly sets the trustpid acronym depending on the domain value.
44
+ * @param domain
45
+ */
46
+ function getDomainAcronym(domain) {
47
+ let acronym = '';
48
+ const prefix = '-';
49
+ switch (domain) {
50
+ case 'tmi.mno.link':
51
+ acronym = 'ndye';
52
+ break;
53
+ case 'tmi.vodafone.de':
54
+ acronym = 'pqnx';
55
+ break;
56
+ case 'tmi.telekom.de':
57
+ acronym = 'avgw';
58
+ break;
59
+ case 'tmi.tmid.es':
60
+ acronym = 'kjws';
61
+ break;
62
+ case 'uat.mno.link':
63
+ acronym = 'xxxx';
64
+ break;
65
+ case 'es.tmiservice.orange.com':
66
+ acronym = 'aplw';
67
+ break;
68
+ default:
69
+ return 'none';
70
+ }
71
+ return mnoAcronym = prefix + acronym;
72
+ }
73
+
74
+ // Set a listener to handle the iframe response message.
75
+ window.addEventListener('message', messageHandler, false);
76
+
77
+ /**
78
+ * Get the "umid" from html5 local storage to make it available to the UserId module.
79
+ * @param config
80
+ * @returns {{trustpid: (*|string), acr: (string)}}
81
+ */
82
+ function getTrustpidFromStorage() {
83
+ // Get the domain either from localStorage or global
84
+ let domain = JSON.parse(storage.getDataFromLocalStorage('fcIdConnectDomain')) || mnoDomain;
85
+ logInfo(`${LOG_PREFIX}: Local storage domain: ${domain}`);
86
+
87
+ if (!domain) {
88
+ logInfo(`${LOG_PREFIX}: Local storage domain not found, returning null`);
89
+ return {
90
+ trustpid: null,
91
+ acr: null,
92
+ };
93
+ }
94
+
95
+ // Get the acronym from global
96
+ let acronym = mnoAcronym;
97
+ // if acronym is empty, but "domain" is available, get the acronym from domain
98
+ if (!acronym) {
99
+ getDomainAcronym(domain);
100
+ acronym = mnoAcronym;
101
+ }
102
+
103
+ logInfo(`${LOG_PREFIX}: Domain acronym found: ${acronym}`);
104
+
105
+ // Domain is correct in both local storage and idGraph, but no acronym is existing for the domain
106
+ if (domain && !acronym) {
107
+ return {
108
+ trustpid: null,
109
+ acr: null
110
+ }
111
+ }
112
+
113
+ let fcIdConnectObject;
114
+ let fcIdConnectData = JSON.parse(storage.getDataFromLocalStorage('fcIdConnectData'));
115
+ logInfo(`${LOG_PREFIX}: Local storage fcIdConnectData: ${JSON.stringify(fcIdConnectData)}`);
116
+
117
+ if (fcIdConnectData &&
118
+ fcIdConnectData.connectId &&
119
+ Array.isArray(fcIdConnectData.connectId.idGraph) &&
120
+ fcIdConnectData.connectId.idGraph.length > 0) {
121
+ fcIdConnectObject = fcIdConnectData.connectId.idGraph.find(item => {
122
+ return item.domain === domain;
123
+ });
124
+ }
125
+ logInfo(`${LOG_PREFIX}: Local storage fcIdConnectObject for domain: ${JSON.stringify(fcIdConnectObject)}`);
126
+
127
+ return {
128
+ trustpid: (fcIdConnectObject && fcIdConnectObject.umid)
129
+ ? fcIdConnectObject.umid
130
+ : null,
131
+ acr: acronym,
132
+ };
133
+ }
134
+
135
+ /** @type {Submodule} */
136
+ export const trustpidSubmodule = {
137
+ /**
138
+ * Used to link submodule with config
139
+ * @type {string}
140
+ */
141
+ name: MODULE_NAME,
142
+ /**
143
+ * Decodes the stored id value for passing to bid requests.
144
+ * @function
145
+ * @returns {{trustpid: string} | null}
146
+ */
147
+ decode(bidId) {
148
+ logInfo(`${LOG_PREFIX}: Decoded ID value ${JSON.stringify(bidId)}`);
149
+ return bidId.trustpid ? bidId : null;
150
+ },
151
+ /**
152
+ * Get the id from helper function and initiate a new user sync.
153
+ * @param config
154
+ * @returns {{callback: result}|{id: {trustpid: string}}}
155
+ */
156
+ getId: function(config) {
157
+ const data = getTrustpidFromStorage();
158
+ if (data.trustpid) {
159
+ logInfo(`${LOG_PREFIX}: Local storage ID value ${JSON.stringify(data)}`);
160
+ return {id: {trustpid: data.trustpid + data.acr}};
161
+ } else {
162
+ if (!config) {
163
+ config = {};
164
+ }
165
+ if (!config.params) {
166
+ config.params = {};
167
+ }
168
+ if (typeof config.params.maxDelayTime === 'undefined' || config.params.maxDelayTime === null) {
169
+ config.params.maxDelayTime = 1000;
170
+ }
171
+ // Current delay and delay step in milliseconds
172
+ let currentDelay = 0;
173
+ const delayStep = 50;
174
+ const result = (callback) => {
175
+ const data = getTrustpidFromStorage();
176
+ if (!data.trustpid) {
177
+ if (currentDelay > config.params.maxDelayTime) {
178
+ logInfo(`${LOG_PREFIX}: No trustpid value set after ${config.params.maxDelayTime} max allowed delay time`);
179
+ callback(null);
180
+ } else {
181
+ currentDelay += delayStep;
182
+ setTimeout(() => {
183
+ result(callback);
184
+ }, delayStep);
185
+ }
186
+ } else {
187
+ const dataToReturn = { trustpid: data.trustpid + data.acr };
188
+ logInfo(`${LOG_PREFIX}: Returning ID value data of ${JSON.stringify(dataToReturn)}`);
189
+ callback(dataToReturn);
190
+ }
191
+ };
192
+ return { callback: result };
193
+ }
194
+ },
195
+ };
196
+
197
+ submodule('userId', trustpidSubmodule);
@@ -0,0 +1,45 @@
1
+ ## trustpid User Id Submodule
2
+
3
+ trustpid User Id Module.
4
+
5
+ First, make sure to add the trustpid submodule to your Prebid.js package with:
6
+
7
+ ```
8
+ gulp build --modules=userId,adfBidAdapter,trustpidSystem
9
+ ```
10
+
11
+ The following configuration parameters are available:
12
+
13
+ ```
14
+ pbjs.setConfig({
15
+ userSync: {
16
+ userIds: [
17
+ {
18
+ name: 'trustpid',
19
+ params: {
20
+ maxDelayTime: 1000,
21
+ },
22
+ bidders: ["adf"],
23
+ storage: {
24
+ type: "html5",
25
+ name: "trustpid",
26
+ expires: 1, //days
27
+ },
28
+ }
29
+ ],
30
+ }
31
+ });
32
+ ```
33
+
34
+ ## Parameter Descriptions
35
+
36
+ | Param under userSync.userIds[] | Scope | Type | Description | Example |
37
+ | --- | --- | --- | --- | --- |
38
+ | name | Required | String | The name of the module | `"trustpid"`
39
+ | params | Required | Object | Object with configuration parameters for trustpid User Id submodule | - |
40
+ | params.maxDelayTime | Required | Integer | Max amount of time (in seconds) before looking into storage for data | 2500 |
41
+ | bidders | Required | Array of Strings | An array of bidder codes to which this user ID may be sent. Currently required and supporting AdformOpenRTB | `["adf"]` |
42
+ | storage | Required | Object | Local storage configuration object | - |
43
+ | storage.type | Required | String | Type of the storage that would be used to store user ID. Must be `"html5"` to utilise HTML5 local storage. | `"html5"` |
44
+ | storage.name | Required | String | The name of the key in local storage where the user ID will be stored. | `"trustpid"` |
45
+ | storage.expires | Required | Integer | How long (in days) the user ID information will be stored. For safety reasons, this information is required.| `1` |
@@ -12,6 +12,20 @@ const FRAME_USER_SYNC = 'https://cdn.undertone.com/js/usersync.html';
12
12
  const PIXEL_USER_SYNC_1 = 'https://usr.undertone.com/userPixel/syncOne?id=1&of=2';
13
13
  const PIXEL_USER_SYNC_2 = 'https://usr.undertone.com/userPixel/syncOne?id=2&of=2';
14
14
 
15
+ function getBidFloor(bidRequest, mediaType) {
16
+ if (typeof bidRequest.getFloor !== 'function') {
17
+ return 0;
18
+ }
19
+
20
+ const floor = bidRequest.getFloor({
21
+ currency: 'USD',
22
+ mediaType: mediaType,
23
+ size: '*'
24
+ });
25
+
26
+ return (floor && floor.currency === 'USD' && floor.floor) || 0;
27
+ }
28
+
15
29
  function getCanonicalUrl() {
16
30
  try {
17
31
  let doc = window.top.document;
@@ -134,6 +148,9 @@ export const spec = {
134
148
  params: bidReq.params
135
149
  };
136
150
  const videoMediaType = deepAccess(bidReq, 'mediaTypes.video');
151
+ const mediaType = videoMediaType ? VIDEO : BANNER;
152
+ bid.mediaType = mediaType;
153
+ bid.bidfloor = getBidFloor(bidReq, mediaType);
137
154
  if (videoMediaType) {
138
155
  bid.video = {
139
156
  playerSize: deepAccess(bidReq, 'mediaTypes.video.playerSize') || null,
@@ -142,7 +159,6 @@ export const spec = {
142
159
  maxDuration: deepAccess(bidReq, 'params.video.maxDuration') || null,
143
160
  skippable: deepAccess(bidReq, 'params.video.skippable') || null
144
161
  };
145
- bid.mediaType = 'video';
146
162
  }
147
163
  payload['x-ut-hb-params'].push(bid);
148
164
  });
@@ -5,6 +5,15 @@ const USER_IDS_CONFIG = {
5
5
 
6
6
  // key-name : {config}
7
7
 
8
+ // trustpid
9
+ 'trustpid': {
10
+ source: 'trustpid.com',
11
+ atype: 1,
12
+ getValue: function (data) {
13
+ return data;
14
+ },
15
+ },
16
+
8
17
  // intentIqId
9
18
  'intentIqId': {
10
19
  source: 'intentiq.com',
@@ -146,7 +155,13 @@ const USER_IDS_CONFIG = {
146
155
  atype: 1
147
156
  },
148
157
 
149
- // haloId
158
+ // hadronId
159
+ 'hadronId': {
160
+ source: 'audigent.com',
161
+ atype: 1
162
+ },
163
+
164
+ // haloId (deprecated in 7.0, use hadronId)
150
165
  'haloId': {
151
166
  source: 'audigent.com',
152
167
  atype: 1
@@ -2,6 +2,14 @@
2
2
 
3
3
  ```
4
4
  userIdAsEids = [
5
+ {
6
+ source: 'trustpid.com',
7
+ uids: [{
8
+ id: 'some-random-id-value',
9
+ atype: 1
10
+ }]
11
+ },
12
+
5
13
  {
6
14
  source: 'pubcid.org',
7
15
  uids: [{
@@ -28,7 +36,7 @@ userIdAsEids = [
28
36
  atype: 1
29
37
  }]
30
38
  },
31
-
39
+
32
40
  {
33
41
  source: 'neustar.biz',
34
42
  uids: [{
@@ -203,7 +211,7 @@ userIdAsEids = [
203
211
  id: 'some-random-id-value',
204
212
  atype: 3
205
213
  }]
206
- },
214
+ },
207
215
  {
208
216
  source: 'kpuid.com',
209
217
  uids: [{
@@ -130,7 +130,7 @@
130
130
  * @property {(string[]|undefined)} submoduleNames - submodules to refresh
131
131
  */
132
132
 
133
- import find from 'core-js-pure/features/array/find.js';
133
+ import find from 'prebidjs-polyfill/find.js';
134
134
  import { config } from '../../src/config.js';
135
135
  import events from '../../src/events.js';
136
136
  import { getGlobal } from '../../src/prebidGlobal.js';
@@ -143,7 +143,7 @@ import {
143
143
  getPrebidInternal, isPlainObject, logError, isArray, cyrb53Hash, deepAccess, timestamp, delayExecution, logInfo, isFn,
144
144
  logWarn, isEmptyStr, isNumber, isGptPubadsDefined
145
145
  } from '../../src/utils.js';
146
- import includes from 'core-js-pure/features/array/includes.js';
146
+ import includes from 'prebidjs-polyfill/includes.js';
147
147
 
148
148
  const MODULE_NAME = 'User ID';
149
149
  const COOKIE = 'cookie';
@@ -1,6 +1,7 @@
1
1
  ## User ID Example Configuration
2
2
 
3
3
  Example showing `cookie` storage for user id data for each of the submodules
4
+
4
5
  ```
5
6
  pbjs.setConfig({
6
7
  userSync: {
@@ -147,10 +148,23 @@ pbjs.setConfig({
147
148
  ```
148
149
 
149
150
  Example showing `localStorage` for user id data for some submodules
151
+
150
152
  ```
151
153
  pbjs.setConfig({
152
154
  userSync: {
153
- userIds: [{
155
+ userIds: [
156
+ {
157
+ name: 'trustpid',
158
+ params: {
159
+ maxDelayTime: 2500
160
+ },
161
+ bidders: ['adform'],
162
+ storage: {
163
+ type: 'html5',
164
+ name: 'trustpid',
165
+ expires: 60
166
+ }
167
+ }, {
154
168
  name: "unifiedId",
155
169
  params: {
156
170
  partner: "prebid",
@@ -278,7 +292,7 @@ pbjs.setConfig({
278
292
  name: "knssoId",
279
293
  expires: 30
280
294
  },
281
- }
295
+ }
282
296
  },
283
297
  {
284
298
  name: 'imuid',
@@ -312,6 +326,7 @@ pbjs.setConfig({
312
326
  ```
313
327
 
314
328
  Example showing how to configure a `value` object to pass directly to bid adapters
329
+
315
330
  ```
316
331
  pbjs.setConfig({
317
332
  userSync: {
@@ -11,7 +11,7 @@ import {
11
11
  isPlainObject,
12
12
  replaceAuctionPrice
13
13
  } from '../src/utils.js';
14
- import find from 'core-js-pure/features/array/find.js';
14
+ import find from 'prebidjs-polyfill/find.js';
15
15
  import {
16
16
  registerBidder
17
17
  } from '../src/adapters/bidderFactory.js';
@@ -8,7 +8,7 @@
8
8
  import {ajax} from '../src/ajax.js';
9
9
  import {submodule} from '../src/hook.js';
10
10
  import { logError, formatQS } from '../src/utils.js';
11
- import includes from 'core-js-pure/features/array/includes.js';
11
+ import includes from 'prebidjs-polyfill/includes.js';
12
12
 
13
13
  const MODULE_NAME = 'verizonMediaId';
14
14
  const VENDOR_ID = 25;