prebid.js 7.35.0 → 7.37.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 (229) hide show
  1. package/.devcontainer/Dockerfile +2 -0
  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/admaruBidAdapter.js +1 -1
  8. package/dist/adrelevantisBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/aidemBidAdapter.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/aolBidAdapter.js +1 -1
  17. package/dist/appierAnalyticsAdapter.js +1 -1
  18. package/dist/appnexusBidAdapter.js +1 -1
  19. package/dist/asoBidAdapter.js +1 -1
  20. package/dist/audiencerunBidAdapter.js +1 -1
  21. package/dist/axonixBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/big-richmediaBidAdapter.js +1 -1
  24. package/dist/bluebillywigBidAdapter.js +1 -1
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/brightcomBidAdapter.js +1 -1
  28. package/dist/brightcomSSPBidAdapter.js +1 -0
  29. package/dist/carodaBidAdapter.js +1 -1
  30. package/dist/chtnwBidAdapter.js +1 -1
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectadBidAdapter.js +1 -1
  33. package/dist/consumableBidAdapter.js +1 -1
  34. package/dist/conversantBidAdapter.js +1 -1
  35. package/dist/craftBidAdapter.js +1 -1
  36. package/dist/criteoBidAdapter.js +1 -1
  37. package/dist/cwireBidAdapter.js +1 -1
  38. package/dist/dependencies.json +3 -0
  39. package/dist/discoveryBidAdapter.js +1 -1
  40. package/dist/dspxBidAdapter.js +1 -1
  41. package/dist/eplanningBidAdapter.js +1 -1
  42. package/dist/feedadBidAdapter.js +1 -1
  43. package/dist/finativeBidAdapter.js +1 -1
  44. package/dist/freewheel-sspBidAdapter.js +1 -1
  45. package/dist/glimpseBidAdapter.js +1 -1
  46. package/dist/gmosspBidAdapter.js +1 -1
  47. package/dist/goldbachBidAdapter.js +1 -1
  48. package/dist/gridBidAdapter.js +1 -1
  49. package/dist/gridNMBidAdapter.js +1 -1
  50. package/dist/gumgumBidAdapter.js +1 -1
  51. package/dist/h12mediaBidAdapter.js +1 -1
  52. package/dist/id5IdSystem.js +1 -1
  53. package/dist/impactifyBidAdapter.js +1 -1
  54. package/dist/improvedigitalBidAdapter.js +1 -1
  55. package/dist/incrxBidAdapter.js +1 -1
  56. package/dist/inmarBidAdapter.js +1 -1
  57. package/dist/insticatorBidAdapter.js +1 -1
  58. package/dist/ixBidAdapter.js +1 -1
  59. package/dist/jixieBidAdapter.js +1 -1
  60. package/dist/justpremiumBidAdapter.js +1 -1
  61. package/dist/konduitAnalyticsAdapter.js +1 -1
  62. package/dist/kueezBidAdapter.js +1 -1
  63. package/dist/kueezRtbBidAdapter.js +1 -1
  64. package/dist/lassoBidAdapter.js +1 -1
  65. package/dist/lifestreetBidAdapter.js +1 -1
  66. package/dist/limelightDigitalBidAdapter.js +1 -1
  67. package/dist/liveIntentIdSystem.js +1 -1
  68. package/dist/livewrappedBidAdapter.js +1 -1
  69. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  70. package/dist/logicadBidAdapter.js +1 -1
  71. package/dist/loglyliftBidAdapter.js +1 -1
  72. package/dist/magniteAnalyticsAdapter.js +1 -1
  73. package/dist/malltvAnalyticsAdapter.js +1 -1
  74. package/dist/marsmediaBidAdapter.js +1 -1
  75. package/dist/mediafuseBidAdapter.js +1 -1
  76. package/dist/mediagoBidAdapter.js +1 -1
  77. package/dist/mediakeysBidAdapter.js +1 -1
  78. package/dist/mediasquareBidAdapter.js +1 -1
  79. package/dist/mgidBidAdapter.js +1 -1
  80. package/dist/minutemediaBidAdapter.js +1 -1
  81. package/dist/minutemediaplusBidAdapter.js +1 -0
  82. package/dist/neuwoRtdProvider.js +1 -0
  83. package/dist/nextMillenniumBidAdapter.js +1 -1
  84. package/dist/nexx360BidAdapter.js +1 -1
  85. package/dist/not-for-prod/prebid.js +141 -137
  86. package/dist/oguryBidAdapter.js +1 -1
  87. package/dist/onetagBidAdapter.js +1 -1
  88. package/dist/ooloAnalyticsAdapter.js +1 -1
  89. package/dist/outbrainBidAdapter.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/prebidServerBidAdapter.js +1 -1
  94. package/dist/proxistoreBidAdapter.js +1 -1
  95. package/dist/publinkIdSystem.js +1 -1
  96. package/dist/pubmaticBidAdapter.js +1 -1
  97. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  98. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  99. package/dist/pxyzBidAdapter.js +1 -1
  100. package/dist/quantcastBidAdapter.js +1 -1
  101. package/dist/readpeakBidAdapter.js +1 -1
  102. package/dist/relaidoBidAdapter.js +1 -1
  103. package/dist/rhythmoneBidAdapter.js +1 -1
  104. package/dist/riseBidAdapter.js +1 -1
  105. package/dist/rubiconAnalyticsAdapter.js +1 -1
  106. package/dist/rubiconBidAdapter.js +1 -1
  107. package/dist/scatteredBidAdapter.js +1 -0
  108. package/dist/seedingAllianceBidAdapter.js +1 -1
  109. package/dist/seedtagBidAdapter.js +1 -1
  110. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  111. package/dist/sharethroughBidAdapter.js +1 -1
  112. package/dist/shinezBidAdapter.js +1 -1
  113. package/dist/sirdataRtdProvider.js +1 -1
  114. package/dist/smaatoBidAdapter.js +1 -1
  115. package/dist/smartadserverBidAdapter.js +1 -1
  116. package/dist/smartxBidAdapter.js +1 -1
  117. package/dist/smilewantedBidAdapter.js +1 -1
  118. package/dist/sonobiBidAdapter.js +1 -1
  119. package/dist/sovrnAnalyticsAdapter.js +1 -1
  120. package/dist/sovrnBidAdapter.js +1 -1
  121. package/dist/sspBCBidAdapter.js +1 -1
  122. package/dist/sublimeBidAdapter.js +1 -1
  123. package/dist/synacormediaBidAdapter.js +1 -1
  124. package/dist/targetVideoBidAdapter.js +1 -1
  125. package/dist/teadsBidAdapter.js +1 -1
  126. package/dist/trionBidAdapter.js +1 -1
  127. package/dist/tripleliftBidAdapter.js +1 -1
  128. package/dist/ttdBidAdapter.js +1 -1
  129. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  130. package/dist/uid2IdSystem.js +1 -1
  131. package/dist/underdogmediaBidAdapter.js +1 -1
  132. package/dist/undertoneBidAdapter.js +1 -1
  133. package/dist/userId.js +1 -1
  134. package/dist/vidazooBidAdapter.js +1 -1
  135. package/dist/videobyteBidAdapter.js +1 -1
  136. package/dist/visxBidAdapter.js +1 -1
  137. package/dist/vuukleBidAdapter.js +1 -1
  138. package/dist/widespaceBidAdapter.js +1 -1
  139. package/dist/winrBidAdapter.js +1 -1
  140. package/dist/yahoosspBidAdapter.js +1 -1
  141. package/dist/yieldmoBidAdapter.js +1 -1
  142. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  143. package/integrationExamples/gpt/neuwoRtdProvider_example.html +190 -0
  144. package/modules/33acrossBidAdapter.js +13 -4
  145. package/modules/adagioBidAdapter.js +14 -14
  146. package/modules/adagioBidAdapter.md +3 -1
  147. package/modules/admaruBidAdapter.js +19 -1
  148. package/modules/aidemBidAdapter.js +90 -65
  149. package/modules/aidemBidAdapter.md +10 -7
  150. package/modules/ajaBidAdapter.js +6 -1
  151. package/modules/amxIdSystem.md +2 -10
  152. package/modules/aolBidAdapter.js +1 -1
  153. package/modules/appnexusBidAdapter.js +45 -48
  154. package/modules/brightcomBidAdapter.js +1 -0
  155. package/modules/brightcomSSPBidAdapter.js +323 -0
  156. package/modules/brightcomSSPBidAdapter.md +46 -0
  157. package/modules/criteoBidAdapter.js +4 -5
  158. package/modules/cwireBidAdapter.md +9 -3
  159. package/modules/discoveryBidAdapter.js +22 -12
  160. package/modules/feedadBidAdapter.js +35 -15
  161. package/modules/fpdModule/index.md +5 -2
  162. package/modules/freewheel-sspBidAdapter.js +5 -1
  163. package/modules/gridBidAdapter.js +3 -1
  164. package/modules/incrxBidAdapter.js +2 -0
  165. package/modules/ixBidAdapter.js +318 -175
  166. package/modules/kueezRtbBidAdapter.js +54 -20
  167. package/modules/limelightDigitalBidAdapter.js +6 -1
  168. package/modules/limelightDigitalBidAdapter.md +12 -2
  169. package/modules/liveIntentIdSystem.js +1 -1
  170. package/modules/livewrappedBidAdapter.js +28 -16
  171. package/modules/mediagoBidAdapter.js +22 -17
  172. package/modules/minutemediaplusBidAdapter.js +291 -0
  173. package/modules/minutemediaplusBidAdapter.md +35 -0
  174. package/modules/neuwoRtdProvider.js +171 -0
  175. package/modules/neuwoRtdProvider.md +40 -0
  176. package/modules/nextMillenniumBidAdapter.js +9 -1
  177. package/modules/nexx360BidAdapter.js +1 -1
  178. package/modules/prebidServerBidAdapter/ortbConverter.js +6 -0
  179. package/modules/proxistoreBidAdapter.js +2 -2
  180. package/modules/pubmaticBidAdapter.js +4 -0
  181. package/modules/pubxaiAnalyticsAdapter.js +2 -2
  182. package/modules/scatteredBidAdapter.js +72 -0
  183. package/modules/scatteredBidAdapter.md +36 -0
  184. package/modules/sirdataRtdProvider.js +262 -284
  185. package/modules/smartxBidAdapter.js +2 -0
  186. package/modules/smilewantedBidAdapter.js +5 -0
  187. package/modules/sonobiBidAdapter.js +1 -10
  188. package/modules/topicsFpdModule.md +62 -0
  189. package/modules/tripleliftBidAdapter.js +4 -0
  190. package/modules/userId/eids.js +1 -1
  191. package/modules/vidazooBidAdapter.js +3 -1
  192. package/modules/yahoosspBidAdapter.js +1 -1
  193. package/modules/yieldmoBidAdapter.js +1 -0
  194. package/package.json +2 -2
  195. package/src/adapterManager.js +30 -14
  196. package/src/utils.js +1 -1
  197. package/test/spec/modules/33acrossBidAdapter_spec.js +51 -18
  198. package/test/spec/modules/adagioBidAdapter_spec.js +2 -2
  199. package/test/spec/modules/admaruBidAdapter_spec.js +48 -0
  200. package/test/spec/modules/aidemBidAdapter_spec.js +77 -10
  201. package/test/spec/modules/ajaBidAdapter_spec.js +21 -1
  202. package/test/spec/modules/aolBidAdapter_spec.js +2 -2
  203. package/test/spec/modules/appnexusBidAdapter_spec.js +123 -16
  204. package/test/spec/modules/brightcomSSPBidAdapter_spec.js +411 -0
  205. package/test/spec/modules/criteoBidAdapter_spec.js +24 -1
  206. package/test/spec/modules/eids_spec.js +1 -1
  207. package/test/spec/modules/feedadBidAdapter_spec.js +47 -77
  208. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +1 -1
  209. package/test/spec/modules/incrxBidAdapter_spec.js +4 -0
  210. package/test/spec/modules/ixBidAdapter_spec.js +24 -54
  211. package/test/spec/modules/kueezRtbBidAdapter_spec.js +63 -22
  212. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +35 -5
  213. package/test/spec/modules/livewrappedBidAdapter_spec.js +267 -2
  214. package/test/spec/modules/minutemediaplusBidAdapter_spec.js +519 -0
  215. package/test/spec/modules/neuwoRtdProvider_spec.js +123 -0
  216. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +11 -0
  217. package/test/spec/modules/prebidServerBidAdapter_spec.js +56 -0
  218. package/test/spec/modules/proxistoreBidAdapter_spec.js +2 -2
  219. package/test/spec/modules/pubmaticBidAdapter_spec.js +15 -0
  220. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +3 -1
  221. package/test/spec/modules/scatteredBidAdapter_spec.js +210 -0
  222. package/test/spec/modules/sirdataRtdProvider_spec.js +116 -22
  223. package/test/spec/modules/smilewantedBidAdapter_spec.js +54 -3
  224. package/test/spec/modules/sonobiBidAdapter_spec.js +3 -25
  225. package/test/spec/modules/tripleliftBidAdapter_spec.js +9 -2
  226. package/test/spec/modules/userId_spec.js +1 -1
  227. package/test/spec/modules/vidazooBidAdapter_spec.js +4 -1
  228. package/test/spec/modules/yahoosspBidAdapter_spec.js +1 -1
  229. package/test/spec/unit/core/adapterManager_spec.js +147 -0
@@ -1,7 +1,8 @@
1
- import { _each, deepAccess, parseSizesInput, parseUrl, uniques, isFn } from '../src/utils.js';
2
- import { registerBidder } from '../src/adapters/bidderFactory.js';
3
- import { BANNER, VIDEO } from '../src/mediaTypes.js';
4
- import { getStorageManager } from '../src/storageManager.js';
1
+ import {_each, deepAccess, parseSizesInput, parseUrl, uniques, isFn} from '../src/utils.js';
2
+ import {registerBidder} from '../src/adapters/bidderFactory.js';
3
+ import {BANNER, VIDEO} from '../src/mediaTypes.js';
4
+ import {getStorageManager} from '../src/storageManager.js';
5
+ import { config } from '../src/config.js';
5
6
 
6
7
  const GVLID = 1165;
7
8
  const DEFAULT_SUB_DOMAIN = 'exchange';
@@ -22,11 +23,11 @@ export const SUPPORTED_ID_SYSTEMS = {
22
23
  'tdid': 1,
23
24
  'pubProvidedId': 1
24
25
  };
25
- const storage = getStorageManager({ gvlid: GVLID, bidderCode: BIDDER_CODE });
26
+ const storage = getStorageManager({gvlid: GVLID, bidderCode: BIDDER_CODE});
26
27
 
27
28
  function getTopWindowQueryParams() {
28
29
  try {
29
- const parsedUrl = parseUrl(window.top.document.URL, { decodeSearchAsString: true });
30
+ const parsedUrl = parseUrl(window.top.document.URL, {decodeSearchAsString: true});
30
31
  return parsedUrl.search;
31
32
  } catch (e) {
32
33
  return '';
@@ -54,9 +55,22 @@ function isBidRequestValid(bid) {
54
55
  return !!(extractCID(params) && extractPID(params));
55
56
  }
56
57
 
57
- function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
58
- const { params, bidId, userId, adUnitCode, schain, mediaTypes } = bid;
59
- let { bidFloor, ext } = params;
58
+ function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
59
+ const {
60
+ params,
61
+ bidId,
62
+ userId,
63
+ adUnitCode,
64
+ schain,
65
+ mediaTypes,
66
+ auctionId,
67
+ transactionId,
68
+ bidderRequestId,
69
+ bidRequestsCount,
70
+ bidderRequestsCount,
71
+ bidderWinsCount
72
+ } = bid;
73
+ let {bidFloor, ext} = params;
60
74
  const hashUrl = hashCode(topWindowUrl);
61
75
  const uniqueDealId = getUniqueDealId(hashUrl);
62
76
  const cId = extractCID(params);
@@ -90,7 +104,14 @@ function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
90
104
  prebidVersion: '$prebid.version$',
91
105
  res: `${screen.width}x${screen.height}`,
92
106
  schain: schain,
93
- mediaTypes: mediaTypes
107
+ mediaTypes: mediaTypes,
108
+ auctionId: auctionId,
109
+ transactionId: transactionId,
110
+ bidderRequestId: bidderRequestId,
111
+ bidRequestsCount: bidRequestsCount,
112
+ bidderRequestsCount: bidderRequestsCount,
113
+ bidderWinsCount: bidderWinsCount,
114
+ bidderTimeout: bidderTimeout
94
115
  };
95
116
 
96
117
  appendUserIdsToRequestPayload(data, userId);
@@ -107,6 +128,14 @@ function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
107
128
  data.usPrivacy = bidderRequest.uspConsent;
108
129
  }
109
130
 
131
+ if (bidderRequest.gppConsent) {
132
+ data.gppString = bidderRequest.gppConsent.gppString;
133
+ data.gppSid = bidderRequest.gppConsent.applicableSections;
134
+ } else if (bidderRequest.ortb2?.regs?.gpp) {
135
+ data.gppString = bidderRequest.ortb2.regs.gpp;
136
+ data.gppSid = bidderRequest.ortb2.regs.gpp_sid;
137
+ }
138
+
110
139
  const dto = {
111
140
  method: 'POST',
112
141
  url: `${createDomain(subDomain)}/prebid/multi/${cId}`,
@@ -148,10 +177,11 @@ function appendUserIdsToRequestPayload(payloadRef, userIds) {
148
177
 
149
178
  function buildRequests(validBidRequests, bidderRequest) {
150
179
  const topWindowUrl = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
180
+ const bidderTimeout = config.getConfig('bidderTimeout');
151
181
  const requests = [];
152
182
  validBidRequests.forEach(validBidRequest => {
153
183
  const sizes = parseSizesInput(validBidRequest.sizes);
154
- const request = buildRequest(validBidRequest, topWindowUrl, sizes, bidderRequest);
184
+ const request = buildRequest(validBidRequest, topWindowUrl, sizes, bidderRequest, bidderTimeout);
155
185
  requests.push(request);
156
186
  });
157
187
  return requests;
@@ -161,14 +191,14 @@ function interpretResponse(serverResponse, request) {
161
191
  if (!serverResponse || !serverResponse.body) {
162
192
  return [];
163
193
  }
164
- const { bidId } = request.data;
165
- const { results } = serverResponse.body;
194
+ const {bidId} = request.data;
195
+ const {results} = serverResponse.body;
166
196
 
167
197
  let output = [];
168
198
 
169
199
  try {
170
200
  results.forEach(result => {
171
- const { creativeId, ad, price, exp, width, height, currency, advertiserDomains, mediaType = BANNER } = result;
201
+ const {creativeId, ad, price, exp, width, height, currency, advertiserDomains, mediaType = BANNER} = result;
172
202
  if (!ad || !price) {
173
203
  return;
174
204
  }
@@ -207,8 +237,8 @@ function interpretResponse(serverResponse, request) {
207
237
 
208
238
  function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '') {
209
239
  let syncs = [];
210
- const { iframeEnabled, pixelEnabled } = syncOptions;
211
- const { gdprApplies, consentString = '' } = gdprConsent;
240
+ const {iframeEnabled, pixelEnabled} = syncOptions;
241
+ const {gdprApplies, consentString = ''} = gdprConsent;
212
242
 
213
243
  const cidArr = responses.filter(resp => deepAccess(resp, 'body.cid')).map(resp => resp.body.cid).filter(uniques);
214
244
  const params = `?cid=${encodeURIComponent(cidArr.join(','))}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${encodeURIComponent(consentString || '')}&us_privacy=${encodeURIComponent(uspConsent || '')}`
@@ -232,7 +262,9 @@ export function hashCode(s, prefix = '_') {
232
262
  let h = 0
233
263
  let i = 0;
234
264
  if (l > 0) {
235
- while (i < l) { h = (h << 5) - h + s.charCodeAt(i++) | 0; }
265
+ while (i < l) {
266
+ h = (h << 5) - h + s.charCodeAt(i++) | 0;
267
+ }
236
268
  }
237
269
  return prefix + h;
238
270
  }
@@ -256,7 +288,8 @@ export function getUniqueDealId(key, expiry = UNIQUE_DEAL_ID_EXPIRY) {
256
288
  export function getStorageItem(key) {
257
289
  try {
258
290
  return tryParseJSON(storage.getDataFromLocalStorage(key));
259
- } catch (e) { }
291
+ } catch (e) {
292
+ }
260
293
 
261
294
  return null;
262
295
  }
@@ -264,9 +297,10 @@ export function getStorageItem(key) {
264
297
  export function setStorageItem(key, value, timestamp) {
265
298
  try {
266
299
  const created = timestamp || Date.now();
267
- const data = JSON.stringify({ value, created });
300
+ const data = JSON.stringify({value, created});
268
301
  storage.setDataInLocalStorage(key, data);
269
- } catch (e) { }
302
+ } catch (e) {
303
+ }
270
304
  }
271
305
 
272
306
  export function tryParseJSON(value) {
@@ -158,7 +158,12 @@ function buildPlacement(bidRequest) {
158
158
  type: bidRequest.params.adUnitType.toUpperCase(),
159
159
  publisherId: bidRequest.params.publisherId,
160
160
  userIdAsEids: bidRequest.userIdAsEids,
161
- supplyChain: bidRequest.schain
161
+ supplyChain: bidRequest.schain,
162
+ custom1: bidRequest.params.custom1,
163
+ custom2: bidRequest.params.custom2,
164
+ custom3: bidRequest.params.custom3,
165
+ custom4: bidRequest.params.custom4,
166
+ custom5: bidRequest.params.custom5
162
167
  }
163
168
  }
164
169
  }
@@ -24,7 +24,12 @@ var adUnits = [{
24
24
  params: {
25
25
  host: 'exchange-9qao.ortb.net',
26
26
  adUnitId: 0,
27
- adUnitType: 'banner'
27
+ adUnitType: 'banner',
28
+ custom1: 'custom1',
29
+ custom2: 'custom2',
30
+ custom3: 'custom3',
31
+ custom4: 'custom4',
32
+ custom5: 'custom5'
28
33
  }
29
34
  }]
30
35
  }];
@@ -40,7 +45,12 @@ var videoAdUnit = [{
40
45
  params: {
41
46
  host: 'exchange-9qao.ortb.net',
42
47
  adUnitId: 0,
43
- adUnitType: 'video'
48
+ adUnitType: 'video',
49
+ custom1: 'custom1',
50
+ custom2: 'custom2',
51
+ custom3: 'custom3',
52
+ custom4: 'custom4',
53
+ custom5: 'custom5'
44
54
  }
45
55
  }]
46
56
  }];
@@ -7,7 +7,7 @@
7
7
  import { triggerPixel, logError } from '../src/utils.js';
8
8
  import { ajaxBuilder } from '../src/ajax.js';
9
9
  import { submodule } from '../src/hook.js';
10
- import { LiveConnect } from 'live-connect-js/esm/initializer.js';
10
+ import { LiveConnect } from 'live-connect-js'; // eslint-disable-line prebid/validate-imports
11
11
  import { gdprDataHandler, uspDataHandler } from '../src/adapterManager.js';
12
12
  import { getStorageManager } from '../src/storageManager.js';
13
13
 
@@ -1,4 +1,4 @@
1
- import {deepAccess, getWindowTop, isSafariBrowser, mergeDeep} from '../src/utils.js';
1
+ import {deepAccess, getWindowTop, isSafariBrowser, mergeDeep, isFn, isPlainObject} from '../src/utils.js';
2
2
  import {registerBidder} from '../src/adapters/bidderFactory.js';
3
3
  import {config} from '../src/config.js';
4
4
  import {find} from '../src/polyfill.js';
@@ -68,7 +68,9 @@ export const spec = {
68
68
  bidUrl = bidUrl ? bidUrl.params.bidUrl : URL;
69
69
  url = url ? url.params.url : (getAppDomain() || getTopWindowLocation(bidderRequest));
70
70
  test = test ? test.params.test : undefined;
71
- var adRequests = bidRequests.map(bidToAdRequest);
71
+ const currency = config.getConfig('currency.adServerCurrency') || 'USD';
72
+ var adRequests = bidRequests.map(b => bidToAdRequest(b, currency));
73
+ const adRequestsContainFloors = adRequests.some(r => r.flr !== undefined);
72
74
 
73
75
  if (eids) {
74
76
  ortb2 = mergeDeep(mergeDeep({}, ortb2 || {}), eids);
@@ -96,7 +98,8 @@ export const spec = {
96
98
  rcv: getAdblockerRecovered(),
97
99
  adRequests: [...adRequests],
98
100
  rtbData: ortb2,
99
- schain: schain
101
+ schain: schain,
102
+ flrCur: adRequestsContainFloors ? currency : undefined
100
103
  };
101
104
 
102
105
  if (config.getConfig().debug) {
@@ -223,13 +226,14 @@ function hasPubcid(bid) {
223
226
  return !!bid.crumbs && !!bid.crumbs.pubcid;
224
227
  }
225
228
 
226
- function bidToAdRequest(bid) {
229
+ function bidToAdRequest(bid, currency) {
227
230
  var adRequest = {
228
231
  adUnitId: bid.params.adUnitId,
229
232
  callerAdUnitId: bid.params.adUnitName || bid.adUnitCode || bid.placementCode,
230
233
  bidId: bid.bidId,
231
234
  transactionId: bid.transactionId,
232
235
  formats: getSizes(bid).map(sizeToFormat),
236
+ flr: getBidFloor(bid, currency),
233
237
  options: bid.params.options
234
238
  };
235
239
 
@@ -264,6 +268,22 @@ function sizeToFormat(size) {
264
268
  }
265
269
  }
266
270
 
271
+ function getBidFloor(bid, currency) {
272
+ if (!isFn(bid.getFloor)) {
273
+ return undefined;
274
+ }
275
+
276
+ const floor = bid.getFloor({
277
+ currency: currency,
278
+ mediaType: '*',
279
+ size: '*'
280
+ });
281
+
282
+ return isPlainObject(floor) && !isNaN(floor.floor) && floor.currency == currency
283
+ ? floor.floor
284
+ : undefined;
285
+ }
286
+
267
287
  function getAdblockerRecovered() {
268
288
  try {
269
289
  return getWindowTop().I12C && getWindowTop().I12C.Morph === 1;
@@ -302,21 +322,13 @@ function getDeviceIfa() {
302
322
  }
303
323
 
304
324
  function getDeviceWidth() {
305
- let device = config.getConfig('device');
306
- if (typeof device === 'object' && device.width) {
307
- return device.width;
308
- }
309
-
310
- return window.innerWidth;
325
+ const device = config.getConfig('device') || {};
326
+ return device.w || window.innerWidth;
311
327
  }
312
328
 
313
329
  function getDeviceHeight() {
314
- let device = config.getConfig('device');
315
- if (typeof device === 'object' && device.height) {
316
- return device.height;
317
- }
318
-
319
- return window.innerHeight;
330
+ const device = config.getConfig('device') || {};
331
+ return device.h || window.innerHeight;
320
332
  }
321
333
 
322
334
  function getCoppa() {
@@ -148,12 +148,12 @@ function isMobileAndTablet() {
148
148
  */
149
149
  // function getBidFloor(bid, mediaType, sizes) {
150
150
  // var floor;
151
- // var size = sizes.length === 1 ? sizes[0] : "*";
152
- // if (typeof bid.getFloor === "function") {
153
- // const floorInfo = bid.getFloor({ currency: "USD", mediaType, size });
151
+ // var size = sizes.length === 1 ? sizes[0] : '*';
152
+ // if (typeof bid.getFloor === 'function') {
153
+ // const floorInfo = bid.getFloor({ currency: 'USD', mediaType, size });
154
154
  // if (
155
- // typeof floorInfo === "object" &&
156
- // floorInfo.currency === "USD" &&
155
+ // typeof floorInfo === 'object' &&
156
+ // floorInfo.currency === 'USD' &&
157
157
  // !isNaN(parseFloat(floorInfo.floor))
158
158
  // ) {
159
159
  // floor = parseFloat(floorInfo.floor);
@@ -255,7 +255,6 @@ function getItems(validBidRequests, bidderRequest) {
255
255
  // utils.deepAccess(req, 'ortb2Imp.ext.gpid') ||
256
256
  // utils.deepAccess(req, 'ortb2Imp.ext.data.pbadslot') ||
257
257
  // utils.deepAccess(req, 'params.placementId', 0);
258
- // console.log("wjh getItems:", req, bidFloor, gpid);
259
258
 
260
259
  // if (mediaTypes.native) {}
261
260
  // banner广告类型
@@ -270,7 +269,7 @@ function getItems(validBidRequests, bidderRequest) {
270
269
  pos: 1,
271
270
  },
272
271
  ext: {
273
- // gpid: gpid, // 加入后无法返回广告
272
+ // gpid: gpid, // 加入后无法返回广告
274
273
  },
275
274
  };
276
275
  itemMaps[id] = {
@@ -296,6 +295,8 @@ function getParam(validBidRequests, bidderRequest) {
296
295
  const sharedid =
297
296
  utils.deepAccess(validBidRequests[0], 'userId.sharedid.id') ||
298
297
  utils.deepAccess(validBidRequests[0], 'userId.pubcid');
298
+ const eids = validBidRequests[0].userIdAsEids || validBidRequests[0].userId;
299
+
299
300
  let isMobile = isMobileAndTablet() ? 1 : 0;
300
301
  // input test status by Publisher. more frequently for test true req
301
302
  let isTest = validBidRequests[0].params.test || 0;
@@ -318,19 +319,23 @@ function getParam(validBidRequests, bidderRequest) {
318
319
  cur: ['USD'],
319
320
  device: {
320
321
  connectiontype: 0,
321
- // ip: '64.188.178.115',
322
+ // ip: '98.61.5.0',
322
323
  js: 1,
323
- // language: "en",
324
- // os: "Microsoft Windows",
325
- // ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19043",
324
+ // language: 'en',
325
+ // os: 'Microsoft Windows',
326
+ // ua: 'Mozilla/5.0 (Linux; Android 12; SM-G970U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36',
326
327
  os: navigator.platform || '',
327
328
  ua: navigator.userAgent,
328
329
  language: /en/.test(navigator.language) ? 'en' : navigator.language,
329
330
  },
330
- ext: {},
331
+ ext: {
332
+ eids,
333
+ },
331
334
  user: {
332
- id: sharedid || pubcid || getUserID(),
335
+ buyeruid: getUserID(),
336
+ id: sharedid || pubcid,
333
337
  },
338
+ eids,
334
339
  site: {
335
340
  name: domain,
336
341
  domain: domain,
@@ -420,12 +425,12 @@ export const spec = {
420
425
  nurl: getProperty(bid, 'nurl'),
421
426
  // adserverTargeting: {
422
427
  // granularityMultiplier: 0.1,
423
- // priceGranularity: "pbHg",
424
- // pbMg: "0.01",
428
+ // priceGranularity: 'pbHg',
429
+ // pbMg: '0.01',
425
430
  // },
426
- // pbMg: "0.01",
431
+ // pbMg: '0.01',
427
432
  // granularityMultiplier: 0.1,
428
- // priceGranularity: "pbHg",
433
+ // priceGranularity: 'pbHg',
429
434
  };
430
435
  bidResponses.push(bidResponse);
431
436
  }
@@ -0,0 +1,291 @@
1
+ import { _each, deepAccess, parseSizesInput, parseUrl, uniques, isFn } from '../src/utils.js';
2
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
3
+ import { BANNER, VIDEO } from '../src/mediaTypes.js';
4
+ import { getStorageManager } from '../src/storageManager.js';
5
+
6
+ const GVLID = 918;
7
+ const DEFAULT_SUB_DOMAIN = 'exchange';
8
+ const BIDDER_CODE = 'mmplus';
9
+ const BIDDER_VERSION = '1.0.0';
10
+ const CURRENCY = 'USD';
11
+ const TTL_SECONDS = 60 * 5;
12
+ const UNIQUE_DEAL_ID_EXPIRY = 1000 * 60 * 15;
13
+ export const SUPPORTED_ID_SYSTEMS = {
14
+ 'britepoolid': 1,
15
+ 'criteoId': 1,
16
+ 'id5id': 1,
17
+ 'idl_env': 1,
18
+ 'lipb': 1,
19
+ 'netId': 1,
20
+ 'parrableId': 1,
21
+ 'pubcid': 1,
22
+ 'tdid': 1,
23
+ 'pubProvidedId': 1
24
+ };
25
+ const storage = getStorageManager({ gvlid: GVLID, bidderCode: BIDDER_CODE });
26
+
27
+ function getTopWindowQueryParams() {
28
+ try {
29
+ const parsedUrl = parseUrl(window.top.document.URL, { decodeSearchAsString: true });
30
+ return parsedUrl.search;
31
+ } catch (e) {
32
+ return '';
33
+ }
34
+ }
35
+
36
+ export function createDomain(subDomain = DEFAULT_SUB_DOMAIN) {
37
+ return `https://${subDomain}.minutemedia-prebid.com`;
38
+ }
39
+
40
+ export function extractCID(params) {
41
+ return params.cId || params.CID || params.cID || params.CId || params.cid || params.ciD || params.Cid || params.CiD;
42
+ }
43
+
44
+ export function extractPID(params) {
45
+ return params.pId || params.PID || params.pID || params.PId || params.pid || params.piD || params.Pid || params.PiD;
46
+ }
47
+
48
+ export function extractSubDomain(params) {
49
+ return params.subDomain || params.SubDomain || params.Subdomain || params.subdomain || params.SUBDOMAIN || params.subDOMAIN;
50
+ }
51
+
52
+ function isBidRequestValid(bid) {
53
+ const params = bid.params || {};
54
+ return !!(extractCID(params) && extractPID(params));
55
+ }
56
+
57
+ function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
58
+ const { params, bidId, userId, adUnitCode, schain, mediaTypes } = bid;
59
+ let { bidFloor, ext } = params;
60
+ const hashUrl = hashCode(topWindowUrl);
61
+ const uniqueDealId = getUniqueDealId(hashUrl);
62
+ const cId = extractCID(params);
63
+ const pId = extractPID(params);
64
+ const subDomain = extractSubDomain(params);
65
+
66
+ if (isFn(bid.getFloor)) {
67
+ const floorInfo = bid.getFloor({
68
+ currency: 'USD',
69
+ mediaType: '*',
70
+ size: '*'
71
+ });
72
+
73
+ if (floorInfo.currency === 'USD') {
74
+ bidFloor = floorInfo.floor;
75
+ }
76
+ }
77
+
78
+ let data = {
79
+ url: encodeURIComponent(topWindowUrl),
80
+ uqs: getTopWindowQueryParams(),
81
+ cb: Date.now(),
82
+ bidFloor: bidFloor,
83
+ bidId: bidId,
84
+ referrer: bidderRequest.refererInfo.ref,
85
+ adUnitCode: adUnitCode,
86
+ publisherId: pId,
87
+ sizes: sizes,
88
+ uniqueDealId: uniqueDealId,
89
+ bidderVersion: BIDDER_VERSION,
90
+ prebidVersion: '$prebid.version$',
91
+ res: `${screen.width}x${screen.height}`,
92
+ schain: schain,
93
+ mediaTypes: mediaTypes
94
+ };
95
+
96
+ appendUserIdsToRequestPayload(data, userId);
97
+
98
+ if (bidderRequest.gdprConsent) {
99
+ if (bidderRequest.gdprConsent.consentString) {
100
+ data.gdprConsent = bidderRequest.gdprConsent.consentString;
101
+ }
102
+ if (bidderRequest.gdprConsent.gdprApplies !== undefined) {
103
+ data.gdpr = bidderRequest.gdprConsent.gdprApplies ? 1 : 0;
104
+ }
105
+ }
106
+ if (bidderRequest.uspConsent) {
107
+ data.usPrivacy = bidderRequest.uspConsent;
108
+ }
109
+
110
+ const dto = {
111
+ method: 'POST',
112
+ url: `${createDomain(subDomain)}/prebid/multi/${cId}`,
113
+ data: data
114
+ };
115
+
116
+ _each(ext, (value, key) => {
117
+ dto.data['ext.' + key] = value;
118
+ });
119
+
120
+ return dto;
121
+ }
122
+
123
+ function appendUserIdsToRequestPayload(payloadRef, userIds) {
124
+ let key;
125
+ _each(userIds, (userId, idSystemProviderName) => {
126
+ if (SUPPORTED_ID_SYSTEMS[idSystemProviderName]) {
127
+ key = `uid.${idSystemProviderName}`;
128
+
129
+ switch (idSystemProviderName) {
130
+ case 'digitrustid':
131
+ payloadRef[key] = deepAccess(userId, 'data.id');
132
+ break;
133
+ case 'lipb':
134
+ payloadRef[key] = userId.lipbid;
135
+ break;
136
+ case 'parrableId':
137
+ payloadRef[key] = userId.eid;
138
+ break;
139
+ case 'id5id':
140
+ payloadRef[key] = userId.uid;
141
+ break;
142
+ default:
143
+ payloadRef[key] = userId;
144
+ }
145
+ }
146
+ });
147
+ }
148
+
149
+ function buildRequests(validBidRequests, bidderRequest) {
150
+ const topWindowUrl = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
151
+ const requests = [];
152
+ validBidRequests.forEach(validBidRequest => {
153
+ const sizes = parseSizesInput(validBidRequest.sizes);
154
+ const request = buildRequest(validBidRequest, topWindowUrl, sizes, bidderRequest);
155
+ requests.push(request);
156
+ });
157
+ return requests;
158
+ }
159
+
160
+ function interpretResponse(serverResponse, request) {
161
+ if (!serverResponse || !serverResponse.body) {
162
+ return [];
163
+ }
164
+ const { bidId } = request.data;
165
+ const { results } = serverResponse.body;
166
+
167
+ let output = [];
168
+
169
+ try {
170
+ results.forEach(result => {
171
+ const { creativeId, ad, price, exp, width, height, currency, advertiserDomains, mediaType = BANNER } = result;
172
+ if (!ad || !price) {
173
+ return;
174
+ }
175
+
176
+ const response = {
177
+ requestId: bidId,
178
+ cpm: price,
179
+ width: width,
180
+ height: height,
181
+ creativeId: creativeId,
182
+ currency: currency || CURRENCY,
183
+ netRevenue: true,
184
+ ttl: exp || TTL_SECONDS,
185
+ meta: {
186
+ advertiserDomains: advertiserDomains || []
187
+ }
188
+ };
189
+
190
+ if (mediaType === BANNER) {
191
+ Object.assign(response, {
192
+ ad: ad,
193
+ });
194
+ } else {
195
+ Object.assign(response, {
196
+ vastXml: ad,
197
+ mediaType: VIDEO
198
+ });
199
+ }
200
+ output.push(response);
201
+ });
202
+ return output;
203
+ } catch (e) {
204
+ return [];
205
+ }
206
+ }
207
+
208
+ function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '') {
209
+ let syncs = [];
210
+ const { iframeEnabled, pixelEnabled } = syncOptions;
211
+ const { gdprApplies, consentString = '' } = gdprConsent;
212
+
213
+ const cidArr = responses.filter(resp => deepAccess(resp, 'body.cid')).map(resp => resp.body.cid).filter(uniques);
214
+ const params = `?cid=${encodeURIComponent(cidArr.join(','))}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${encodeURIComponent(consentString || '')}&us_privacy=${encodeURIComponent(uspConsent || '')}`
215
+ if (iframeEnabled) {
216
+ syncs.push({
217
+ type: 'iframe',
218
+ url: `https://sync.minutemedia-prebid.com/api/sync/iframe/${params}`
219
+ });
220
+ }
221
+ if (pixelEnabled) {
222
+ syncs.push({
223
+ type: 'image',
224
+ url: `https://sync.minutemedia-prebid.com/api/sync/image/${params}`
225
+ });
226
+ }
227
+ return syncs;
228
+ }
229
+
230
+ export function hashCode(s, prefix = '_') {
231
+ const l = s.length;
232
+ let h = 0
233
+ let i = 0;
234
+ if (l > 0) {
235
+ while (i < l) { h = (h << 5) - h + s.charCodeAt(i++) | 0; }
236
+ }
237
+ return prefix + h;
238
+ }
239
+
240
+ export function getUniqueDealId(key, expiry = UNIQUE_DEAL_ID_EXPIRY) {
241
+ const storageKey = `u_${key}`;
242
+ const now = Date.now();
243
+ const data = getStorageItem(storageKey);
244
+ let uniqueId;
245
+
246
+ if (!data || !data.value || now - data.created > expiry) {
247
+ uniqueId = `${key}_${now.toString()}`;
248
+ setStorageItem(storageKey, uniqueId);
249
+ } else {
250
+ uniqueId = data.value;
251
+ }
252
+
253
+ return uniqueId;
254
+ }
255
+
256
+ export function getStorageItem(key) {
257
+ try {
258
+ return tryParseJSON(storage.getDataFromLocalStorage(key));
259
+ } catch (e) { }
260
+
261
+ return null;
262
+ }
263
+
264
+ export function setStorageItem(key, value, timestamp) {
265
+ try {
266
+ const created = timestamp || Date.now();
267
+ const data = JSON.stringify({ value, created });
268
+ storage.setDataInLocalStorage(key, data);
269
+ } catch (e) { }
270
+ }
271
+
272
+ export function tryParseJSON(value) {
273
+ try {
274
+ return JSON.parse(value);
275
+ } catch (e) {
276
+ return value;
277
+ }
278
+ }
279
+
280
+ export const spec = {
281
+ code: BIDDER_CODE,
282
+ version: BIDDER_VERSION,
283
+ gvlid: GVLID,
284
+ supportedMediaTypes: [BANNER, VIDEO],
285
+ isBidRequestValid,
286
+ buildRequests,
287
+ interpretResponse,
288
+ getUserSyncs
289
+ };
290
+
291
+ registerBidder(spec);