prebid.js 9.5.0 → 9.6.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 (197) hide show
  1. package/dist/33acrossAnalyticsAdapter.js +1 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.js +1 -1
  4. package/dist/BTBidAdapter.js +1 -1
  5. package/dist/adagioAnalyticsAdapter.js +1 -1
  6. package/dist/adagioBidAdapter.js +1 -1
  7. package/dist/adagioUtils.js +1 -1
  8. package/dist/addefendBidAdapter.js +1 -1
  9. package/dist/adgenerationBidAdapter.js +1 -1
  10. package/dist/adkernelBidAdapter.js +1 -1
  11. package/dist/adlooxRtdProvider.js +1 -1
  12. package/dist/adqueryBidAdapter.js +1 -1
  13. package/dist/adrelevantisBidAdapter.js +1 -1
  14. package/dist/adstirBidAdapter.js +1 -1
  15. package/dist/adtrgtmeBidAdapter.js +1 -1
  16. package/dist/adxcgAnalyticsAdapter.js +1 -1
  17. package/dist/adxcgBidAdapter.js +1 -1
  18. package/dist/adyoulikeBidAdapter.js +1 -1
  19. package/dist/agmaAnalyticsAdapter.js +1 -1
  20. package/dist/aidemBidAdapter.js +1 -1
  21. package/dist/ajaBidAdapter.js +1 -1
  22. package/dist/amxBidAdapter.js +1 -1
  23. package/dist/amxIdSystem.js +1 -1
  24. package/dist/appierAnalyticsAdapter.js +1 -1
  25. package/dist/appnexusBidAdapter.js +1 -1
  26. package/dist/asoBidAdapter.js +1 -1
  27. package/dist/axonixBidAdapter.js +1 -1
  28. package/dist/bidglassBidAdapter.js +1 -1
  29. package/dist/big-richmediaBidAdapter.js +1 -1
  30. package/dist/bridBidAdapter.js +1 -1
  31. package/dist/bridgewellBidAdapter.js +1 -1
  32. package/dist/brightMountainMediaBidAdapter.js +1 -1
  33. package/dist/carodaBidAdapter.js +1 -1
  34. package/dist/chtnwBidAdapter.js +1 -1
  35. package/dist/chunk-core.js +1 -1
  36. package/dist/concertBidAdapter.js +1 -1
  37. package/dist/connectIdSystem.js +1 -1
  38. package/dist/connectadBidAdapter.js +1 -1
  39. package/dist/consumableBidAdapter.js +1 -1
  40. package/dist/conversantAnalyticsAdapter.js +1 -1
  41. package/dist/conversantBidAdapter.js +1 -1
  42. package/dist/craftBidAdapter.js +1 -1
  43. package/dist/criteoBidAdapter.js +1 -1
  44. package/dist/cwireBidAdapter.js +1 -1
  45. package/dist/dailymotionBidAdapter.js +1 -1
  46. package/dist/dependencies.json +26 -1
  47. package/dist/dspxBidAdapter.js +1 -1
  48. package/dist/dxkultureBidAdapter.js +1 -1
  49. package/dist/eplanningBidAdapter.js +1 -1
  50. package/dist/euidIdSystem.js +1 -1
  51. package/dist/exadsBidAdapter.js +1 -1
  52. package/dist/feedadBidAdapter.js +1 -1
  53. package/dist/finativeBidAdapter.js +1 -1
  54. package/dist/freewheel-sspBidAdapter.js +1 -1
  55. package/dist/gmosspBidAdapter.js +1 -1
  56. package/dist/goldbachBidAdapter.js +1 -1
  57. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  58. package/dist/greenbidsRtdProvider.js +1 -1
  59. package/dist/gridBidAdapter.js +1 -1
  60. package/dist/gumgumBidAdapter.js +1 -1
  61. package/dist/h12mediaBidAdapter.js +1 -1
  62. package/dist/hypelabBidAdapter.js +1 -1
  63. package/dist/id5AnalyticsAdapter.js +1 -1
  64. package/dist/id5IdSystem.js +1 -1
  65. package/dist/imdsBidAdapter.js +1 -1
  66. package/dist/improvedigitalBidAdapter.js +1 -1
  67. package/dist/insticatorBidAdapter.js +1 -1
  68. package/dist/intentIqAnalyticsAdapter.js +1 -1
  69. package/dist/ixBidAdapter.js +1 -1
  70. package/dist/jixieBidAdapter.js +1 -1
  71. package/dist/justpremiumBidAdapter.js +1 -1
  72. package/dist/kargoBidAdapter.js +1 -1
  73. package/dist/kimberliteBidAdapter.js +1 -1
  74. package/dist/konduitAnalyticsAdapter.js +1 -1
  75. package/dist/kueezBidAdapter.js +1 -1
  76. package/dist/lassoBidAdapter.js +1 -1
  77. package/dist/lifestreetBidAdapter.js +1 -1
  78. package/dist/liveIntentIdSystem.js +1 -1
  79. package/dist/logicadBidAdapter.js +1 -1
  80. package/dist/loglyliftBidAdapter.js +1 -1
  81. package/dist/luceadBidAdapter.js +1 -1
  82. package/dist/mabidderBidAdapter.js +1 -1
  83. package/dist/magniteAnalyticsAdapter.js +1 -1
  84. package/dist/malltvAnalyticsAdapter.js +1 -1
  85. package/dist/marsmediaBidAdapter.js +1 -1
  86. package/dist/mediafuseBidAdapter.js +1 -1
  87. package/dist/medianetAnalyticsAdapter.js +1 -1
  88. package/dist/medianetBidAdapter.js +1 -1
  89. package/dist/mediasquareBidAdapter.js +1 -1
  90. package/dist/mgidBidAdapter.js +1 -1
  91. package/dist/minutemediaBidAdapter.js +1 -1
  92. package/dist/missenaBidAdapter.js +1 -1
  93. package/dist/nexx360BidAdapter.js +1 -1
  94. package/dist/nobidAnalyticsAdapter.js +1 -1
  95. package/dist/nobidBidAdapter.js +1 -1
  96. package/dist/not-for-prod/prebid.js +163 -162
  97. package/dist/oguryBidAdapter.js +1 -1
  98. package/dist/onetagBidAdapter.js +1 -1
  99. package/dist/ooloAnalyticsAdapter.js +1 -1
  100. package/dist/openwebBidAdapter.js +1 -1
  101. package/dist/openxBidAdapter.js +1 -1
  102. package/dist/optidigitalBidAdapter.js +1 -1
  103. package/dist/orbidderBidAdapter.js +1 -1
  104. package/dist/outbrainBidAdapter.js +1 -1
  105. package/dist/pixfutureBidAdapter.js +1 -1
  106. package/dist/publinkIdSystem.js +1 -1
  107. package/dist/publirBidAdapter.js +1 -1
  108. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  109. package/dist/pubmaticBidAdapter.js +1 -1
  110. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  111. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  112. package/dist/pxyzBidAdapter.js +1 -1
  113. package/dist/quantcastBidAdapter.js +1 -1
  114. package/dist/readpeakBidAdapter.js +1 -1
  115. package/dist/relaidoBidAdapter.js +1 -1
  116. package/dist/retailspotBidAdapter.js +1 -1
  117. package/dist/rhythmoneBidAdapter.js +1 -1
  118. package/dist/riseBidAdapter.js +1 -1
  119. package/dist/riseUtils.js +1 -0
  120. package/dist/rubiconBidAdapter.js +1 -1
  121. package/dist/seedingAllianceBidAdapter.js +1 -1
  122. package/dist/seedtagBidAdapter.js +1 -1
  123. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  124. package/dist/sharethroughBidAdapter.js +1 -1
  125. package/dist/shinezBidAdapter.js +1 -1
  126. package/dist/smaatoBidAdapter.js +1 -1
  127. package/dist/smartadserverBidAdapter.js +1 -1
  128. package/dist/smarthubBidAdapter.js +1 -1
  129. package/dist/smartxBidAdapter.js +1 -1
  130. package/dist/smilewantedBidAdapter.js +1 -1
  131. package/dist/snigelBidAdapter.js +1 -1
  132. package/dist/sonobiBidAdapter.js +1 -1
  133. package/dist/sovrnBidAdapter.js +1 -1
  134. package/dist/sspBCBidAdapter.js +1 -1
  135. package/dist/stnBidAdapter.js +1 -1
  136. package/dist/stvBidAdapter.js +1 -1
  137. package/dist/sublimeBidAdapter.js +1 -1
  138. package/dist/taboolaBidAdapter.js +1 -1
  139. package/dist/tappxBidAdapter.js +1 -1
  140. package/dist/targetVideoBidAdapter.js +1 -1
  141. package/dist/teadsBidAdapter.js +1 -1
  142. package/dist/telariaBidAdapter.js +1 -1
  143. package/dist/teqblazeUtils.js +1 -1
  144. package/dist/terceptAnalyticsAdapter.js +1 -1
  145. package/dist/themoneytizerBidAdapter.js +1 -1
  146. package/dist/trionBidAdapter.js +1 -1
  147. package/dist/tripleliftBidAdapter.js +1 -1
  148. package/dist/ttdBidAdapter.js +1 -1
  149. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  150. package/dist/uid2IdSystem.js +1 -1
  151. package/dist/uid2IdSystem_shared.js +1 -1
  152. package/dist/underdogmediaBidAdapter.js +1 -1
  153. package/dist/undertoneBidAdapter.js +1 -1
  154. package/dist/unrulyBidAdapter.js +1 -1
  155. package/dist/vidazooUtils.js +1 -1
  156. package/dist/videobyteBidAdapter.js +1 -1
  157. package/dist/visxBidAdapter.js +1 -1
  158. package/dist/vuukleBidAdapter.js +1 -1
  159. package/dist/widespaceBidAdapter.js +1 -1
  160. package/dist/winrBidAdapter.js +1 -1
  161. package/dist/yahooAdsBidAdapter.js +1 -1
  162. package/dist/yieldmoBidAdapter.js +1 -1
  163. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  164. package/libraries/riseUtils/index.js +330 -0
  165. package/libraries/teqblazeUtils/bidderUtils.js +15 -11
  166. package/modules/adagioAnalyticsAdapter.js +101 -84
  167. package/modules/adagioAnalyticsAdapter.md +4 -0
  168. package/modules/adagioBidAdapter.js +4 -16
  169. package/modules/adkernelBidAdapter.js +2 -2
  170. package/modules/aidemBidAdapter.js +2 -0
  171. package/modules/connectIdSystem.js +5 -3
  172. package/modules/insticatorBidAdapter.js +35 -31
  173. package/modules/kargoBidAdapter.js +11 -14
  174. package/modules/kimberliteBidAdapter.js +24 -7
  175. package/modules/kimberliteBidAdapter.md +30 -1
  176. package/modules/minutemediaBidAdapter.js +21 -398
  177. package/modules/nexx360BidAdapter.js +3 -2
  178. package/modules/openwebBidAdapter.js +18 -396
  179. package/modules/publirBidAdapter.js +20 -273
  180. package/modules/resetdigitalBidAdapter.md +54 -45
  181. package/modules/riseBidAdapter.js +19 -400
  182. package/modules/shinezBidAdapter.js +17 -361
  183. package/modules/smarthubBidAdapter.js +45 -177
  184. package/modules/stnBidAdapter.js +22 -398
  185. package/modules/telariaBidAdapter.js +2 -32
  186. package/modules/uid2IdSystem_shared.js +51 -39
  187. package/package.json +1 -1
  188. package/src/prebid.js +4 -0
  189. package/test/spec/modules/adagioAnalyticsAdapter_spec.js +231 -141
  190. package/test/spec/modules/adagioBidAdapter_spec.js +32 -66
  191. package/test/spec/modules/connectIdSystem_spec.js +27 -28
  192. package/test/spec/modules/insticatorBidAdapter_spec.js +8 -1
  193. package/test/spec/modules/kargoBidAdapter_spec.js +7 -8
  194. package/test/spec/modules/kimberliteBidAdapter_spec.js +137 -65
  195. package/test/spec/modules/nexx360BidAdapter_spec.js +1 -1
  196. package/test/spec/modules/smarthubBidAdapter_spec.js +6 -4
  197. package/test/spec/unit/pbjs_api_spec.js +11 -0
@@ -2,33 +2,32 @@ import {
2
2
  logWarn,
3
3
  logInfo,
4
4
  isArray,
5
- isFn,
6
5
  deepAccess,
7
- isEmpty,
8
- contains,
9
- timestamp,
10
6
  triggerPixel,
11
- isInteger,
12
- getBidIdParameter
13
7
  } from '../src/utils.js';
14
- import {registerBidder} from '../src/adapters/bidderFactory.js';
15
- import {BANNER, VIDEO} from '../src/mediaTypes.js';
16
- import {config} from '../src/config.js';
17
-
18
- const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
19
- const BIDDER_CODE = 'stn';
20
- const ADAPTER_VERSION = '6.0.0';
21
- const TTL = 360;
22
- const DEFAULT_CURRENCY = 'USD';
23
- const SELLER_ENDPOINT = 'https://hb.stngo.com/';
24
- const MODES = {
8
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
9
+ import { BANNER, VIDEO } from '../src/mediaTypes.js';
10
+ import {
11
+ getEndpoint,
12
+ generateBidsParams,
13
+ generateGeneralParams,
14
+ buildBidResponse,
15
+ } from '../libraries/riseUtils/index.js';
16
+
17
+ export const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
18
+ export const BIDDER_CODE = 'stn';
19
+ export const ADAPTER_VERSION = '6.1.0';
20
+ export const TTL = 360;
21
+ export const DEFAULT_CURRENCY = 'USD';
22
+ export const SELLER_ENDPOINT = 'https://hb.stngo.com/';
23
+ export const MODES = {
25
24
  PRODUCTION: 'hb-multi',
26
25
  TEST: 'hb-multi-test'
27
- }
28
- const SUPPORTED_SYNC_METHODS = {
26
+ };
27
+ export const SUPPORTED_SYNC_METHODS = {
29
28
  IFRAME: 'iframe',
30
29
  PIXEL: 'pixel'
31
- }
30
+ };
32
31
 
33
32
  export const spec = {
34
33
  code: BIDDER_CODE,
@@ -50,7 +49,6 @@ export const spec = {
50
49
  buildRequests: function (validBidRequests, bidderRequest) {
51
50
  const combinedRequestsObject = {};
52
51
 
53
- // use data from the first bid, to create the general params for all bids
54
52
  const generalObject = validBidRequests[0];
55
53
  const testMode = generalObject.params.testMode;
56
54
 
@@ -59,41 +57,16 @@ export const spec = {
59
57
 
60
58
  return {
61
59
  method: 'POST',
62
- url: getEndpoint(testMode),
60
+ url: getEndpoint(testMode, SELLER_ENDPOINT, MODES),
63
61
  data: combinedRequestsObject
64
62
  }
65
63
  },
66
- interpretResponse: function ({body}) {
64
+ interpretResponse: function ({ body }) {
67
65
  const bidResponses = [];
68
66
 
69
67
  if (body.bids) {
70
68
  body.bids.forEach(adUnit => {
71
- const bidResponse = {
72
- requestId: adUnit.requestId,
73
- cpm: adUnit.cpm,
74
- currency: adUnit.currency || DEFAULT_CURRENCY,
75
- width: adUnit.width,
76
- height: adUnit.height,
77
- ttl: adUnit.ttl || TTL,
78
- creativeId: adUnit.creativeId,
79
- netRevenue: adUnit.netRevenue || true,
80
- nurl: adUnit.nurl,
81
- mediaType: adUnit.mediaType,
82
- meta: {
83
- mediaType: adUnit.mediaType
84
- }
85
- };
86
-
87
- if (adUnit.mediaType === VIDEO) {
88
- bidResponse.vastXml = adUnit.vastXml;
89
- } else if (adUnit.mediaType === BANNER) {
90
- bidResponse.ad = adUnit.ad;
91
- }
92
-
93
- if (adUnit.adomain && adUnit.adomain.length) {
94
- bidResponse.meta.advertiserDomains = adUnit.adomain;
95
- }
96
-
69
+ const bidResponse = buildBidResponse(adUnit, DEFAULT_CURRENCY, TTL, VIDEO, BANNER);
97
70
  bidResponses.push(bidResponse);
98
71
  });
99
72
  }
@@ -134,352 +107,3 @@ export const spec = {
134
107
  };
135
108
 
136
109
  registerBidder(spec);
137
-
138
- /**
139
- * Get floor price
140
- * @param bid {bid}
141
- * @param mediaType {String}
142
- * @returns {Number}
143
- */
144
- function getFloor(bid, mediaType) {
145
- if (!isFn(bid.getFloor)) {
146
- return 0;
147
- }
148
- let floorResult = bid.getFloor({
149
- currency: DEFAULT_CURRENCY,
150
- mediaType: mediaType,
151
- size: '*'
152
- });
153
- return floorResult.currency === DEFAULT_CURRENCY && floorResult.floor ? floorResult.floor : 0;
154
- }
155
-
156
- /**
157
- * Get the ad sizes array from the bid
158
- * @param bid {bid}
159
- * @param mediaType {String}
160
- * @returns {Array}
161
- */
162
- function getSizesArray(bid, mediaType) {
163
- let sizesArray = []
164
-
165
- if (deepAccess(bid, `mediaTypes.${mediaType}.sizes`)) {
166
- sizesArray = bid.mediaTypes[mediaType].sizes;
167
- } else if (Array.isArray(bid.sizes) && bid.sizes.length > 0) {
168
- sizesArray = bid.sizes;
169
- }
170
-
171
- return sizesArray;
172
- }
173
-
174
- /**
175
- * Get schain string value
176
- * @param schainObject {Object}
177
- * @returns {string}
178
- */
179
- function getSupplyChain(schainObject) {
180
- if (isEmpty(schainObject)) {
181
- return '';
182
- }
183
- let scStr = `${schainObject.ver},${schainObject.complete}`;
184
- schainObject.nodes.forEach((node) => {
185
- scStr += '!';
186
- scStr += `${getEncodedValIfNotEmpty(node.asi)},`;
187
- scStr += `${getEncodedValIfNotEmpty(node.sid)},`;
188
- scStr += `${getEncodedValIfNotEmpty(node.hp)},`;
189
- scStr += `${getEncodedValIfNotEmpty(node.rid)},`;
190
- scStr += `${getEncodedValIfNotEmpty(node.name)},`;
191
- scStr += `${getEncodedValIfNotEmpty(node.domain)}`;
192
- });
193
- return scStr;
194
- }
195
-
196
- /**
197
- * Get encoded node value
198
- * @param val {string}
199
- * @returns {string}
200
- */
201
- function getEncodedValIfNotEmpty(val) {
202
- return (val !== '' && val !== undefined) ? encodeURIComponent(val) : '';
203
- }
204
-
205
- /**
206
- * Get preferred user-sync method based on publisher configuration
207
- * @param filterSettings {Object}
208
- * @param bidderCode {string}
209
- * @returns {string}
210
- */
211
- function getAllowedSyncMethod(filterSettings, bidderCode) {
212
- const iframeConfigsToCheck = ['all', 'iframe'];
213
- const pixelConfigToCheck = 'image';
214
- if (filterSettings && iframeConfigsToCheck.some(config => isSyncMethodAllowed(filterSettings[config], bidderCode))) {
215
- return SUPPORTED_SYNC_METHODS.IFRAME;
216
- }
217
- if (!filterSettings || !filterSettings[pixelConfigToCheck] || isSyncMethodAllowed(filterSettings[pixelConfigToCheck], bidderCode)) {
218
- return SUPPORTED_SYNC_METHODS.PIXEL;
219
- }
220
- }
221
-
222
- /**
223
- * Check if sync rule is supported
224
- * @param syncRule {Object}
225
- * @param bidderCode {string}
226
- * @returns {boolean}
227
- */
228
- function isSyncMethodAllowed(syncRule, bidderCode) {
229
- if (!syncRule) {
230
- return false;
231
- }
232
- const isInclude = syncRule.filter === 'include';
233
- const bidders = isArray(syncRule.bidders) ? syncRule.bidders : [bidderCode];
234
- return isInclude && contains(bidders, bidderCode);
235
- }
236
-
237
- /**
238
- * Get the seller endpoint
239
- * @param testMode {boolean}
240
- * @returns {string}
241
- */
242
- function getEndpoint(testMode) {
243
- return testMode
244
- ? SELLER_ENDPOINT + MODES.TEST
245
- : SELLER_ENDPOINT + MODES.PRODUCTION;
246
- }
247
-
248
- /**
249
- * get device type
250
- * @param ua {ua}
251
- * @returns {string}
252
- */
253
- function getDeviceType(ua) {
254
- if (/ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i
255
- .test(ua.toLowerCase())) {
256
- return '5';
257
- }
258
- if (/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i
259
- .test(ua.toLowerCase())) {
260
- return '4';
261
- }
262
- if (/smart[-_\s]?tv|hbbtv|appletv|googletv|hdmi|netcast|viera|nettv|roku|\bdtv\b|sonydtv|inettvbrowser|\btv\b/i
263
- .test(ua.toLowerCase())) {
264
- return '3';
265
- }
266
- return '1';
267
- }
268
-
269
- function generateBidsParams(validBidRequests, bidderRequest) {
270
- const bidsArray = [];
271
-
272
- if (validBidRequests.length) {
273
- validBidRequests.forEach(bid => {
274
- bidsArray.push(generateBidParameters(bid, bidderRequest));
275
- });
276
- }
277
-
278
- return bidsArray;
279
- }
280
-
281
- /**
282
- * Generate bid specific parameters
283
- * @param {bid} bid
284
- * @param {bidderRequest} bidderRequest
285
- * @returns {Object} bid specific params object
286
- */
287
- function generateBidParameters(bid, bidderRequest) {
288
- const {params} = bid;
289
- const mediaType = isBanner(bid) ? BANNER : VIDEO;
290
- const sizesArray = getSizesArray(bid, mediaType);
291
-
292
- // fix floor price in case of NAN
293
- if (isNaN(params.floorPrice)) {
294
- params.floorPrice = 0;
295
- }
296
-
297
- const bidObject = {
298
- mediaType,
299
- adUnitCode: getBidIdParameter('adUnitCode', bid),
300
- sizes: sizesArray,
301
- floorPrice: Math.max(getFloor(bid, mediaType), params.floorPrice),
302
- bidId: getBidIdParameter('bidId', bid),
303
- loop: getBidIdParameter('bidderRequestsCount', bid),
304
- bidderRequestId: getBidIdParameter('bidderRequestId', bid),
305
- transactionId: bid.ortb2Imp?.ext?.tid || '',
306
- coppa: 0,
307
- };
308
-
309
- const pos = deepAccess(bid, `mediaTypes.${mediaType}.pos`);
310
- if (pos) {
311
- bidObject.pos = pos;
312
- }
313
-
314
- const gpid = deepAccess(bid, `ortb2Imp.ext.gpid`);
315
- if (gpid) {
316
- bidObject.gpid = gpid;
317
- }
318
-
319
- const placementId = params.placementId || deepAccess(bid, `mediaTypes.${mediaType}.name`);
320
- if (placementId) {
321
- bidObject.placementId = placementId;
322
- }
323
-
324
- const mimes = deepAccess(bid, `mediaTypes.${mediaType}.mimes`);
325
- if (mimes) {
326
- bidObject.mimes = mimes;
327
- }
328
- const api = deepAccess(bid, `mediaTypes.${mediaType}.api`);
329
- if (api) {
330
- bidObject.api = api;
331
- }
332
-
333
- const sua = deepAccess(bid, `ortb2.device.sua`);
334
- if (sua) {
335
- bidObject.sua = sua;
336
- }
337
-
338
- const coppa = deepAccess(bid, `ortb2.regs.coppa`)
339
- if (coppa) {
340
- bidObject.coppa = 1;
341
- }
342
-
343
- if (mediaType === VIDEO) {
344
- const playbackMethod = deepAccess(bid, `mediaTypes.video.playbackmethod`);
345
- let playbackMethodValue;
346
-
347
- // verify playbackMethod is of type integer array, or integer only.
348
- if (Array.isArray(playbackMethod) && isInteger(playbackMethod[0])) {
349
- // only the first playbackMethod in the array will be used, according to OpenRTB 2.5 recommendation
350
- playbackMethodValue = playbackMethod[0];
351
- } else if (isInteger(playbackMethod)) {
352
- playbackMethodValue = playbackMethod;
353
- }
354
-
355
- if (playbackMethodValue) {
356
- bidObject.playbackMethod = playbackMethodValue;
357
- }
358
-
359
- const placement = deepAccess(bid, `mediaTypes.video.placement`);
360
- if (placement) {
361
- bidObject.placement = placement;
362
- }
363
-
364
- const minDuration = deepAccess(bid, `mediaTypes.video.minduration`);
365
- if (minDuration) {
366
- bidObject.minDuration = minDuration;
367
- }
368
-
369
- const maxDuration = deepAccess(bid, `mediaTypes.video.maxduration`);
370
- if (maxDuration) {
371
- bidObject.maxDuration = maxDuration;
372
- }
373
-
374
- const skip = deepAccess(bid, `mediaTypes.video.skip`);
375
- if (skip) {
376
- bidObject.skip = skip;
377
- }
378
-
379
- const linearity = deepAccess(bid, `mediaTypes.video.linearity`);
380
- if (linearity) {
381
- bidObject.linearity = linearity;
382
- }
383
-
384
- const protocols = deepAccess(bid, `mediaTypes.video.protocols`);
385
- if (protocols) {
386
- bidObject.protocols = protocols;
387
- }
388
-
389
- const plcmt = deepAccess(bid, `mediaTypes.video.plcmt`);
390
- if (plcmt) {
391
- bidObject.plcmt = plcmt;
392
- }
393
- }
394
-
395
- return bidObject;
396
- }
397
-
398
- function isBanner(bid) {
399
- return bid.mediaTypes && bid.mediaTypes.banner;
400
- }
401
-
402
- /**
403
- * Generate params that are common between all bids
404
- * @param {single bid object} generalObject
405
- * @param {bidderRequest} bidderRequest
406
- * @returns {object} the common params object
407
- */
408
- function generateGeneralParams(generalObject, bidderRequest) {
409
- const domain = window.location.hostname;
410
- const {syncEnabled, filterSettings} = config.getConfig('userSync') || {};
411
- const {bidderCode} = bidderRequest;
412
- const generalBidParams = generalObject.params;
413
- const timeout = bidderRequest.timeout;
414
-
415
- // these params are snake_case instead of camelCase to allow backwards compatability on the server.
416
- // in the future, these will be converted to camelCase to match our convention.
417
- const generalParams = {
418
- wrapper_type: 'prebidjs',
419
- wrapper_vendor: '$$PREBID_GLOBAL$$',
420
- wrapper_version: '$prebid.version$',
421
- adapter_version: ADAPTER_VERSION,
422
- auction_start: timestamp(),
423
- publisher_id: generalBidParams.org,
424
- publisher_name: domain,
425
- site_domain: domain,
426
- dnt: (navigator.doNotTrack === 'yes' || navigator.doNotTrack === '1' || navigator.msDoNotTrack === '1') ? 1 : 0,
427
- device_type: getDeviceType(navigator.userAgent),
428
- ua: navigator.userAgent,
429
- is_wrapper: !!generalBidParams.isWrapper,
430
- session_id: generalBidParams.sessionId || getBidIdParameter('bidderRequestId', generalObject),
431
- tmax: timeout
432
- }
433
-
434
- const userIdsParam = getBidIdParameter('userId', generalObject);
435
- if (userIdsParam) {
436
- generalParams.userIds = JSON.stringify(userIdsParam);
437
- }
438
-
439
- const ortb2Metadata = bidderRequest.ortb2 || {};
440
- if (ortb2Metadata.site) {
441
- generalParams.site_metadata = JSON.stringify(ortb2Metadata.site);
442
- }
443
- if (ortb2Metadata.user) {
444
- generalParams.user_metadata = JSON.stringify(ortb2Metadata.user);
445
- }
446
-
447
- if (syncEnabled) {
448
- const allowedSyncMethod = getAllowedSyncMethod(filterSettings, bidderCode);
449
- if (allowedSyncMethod) {
450
- generalParams.cs_method = allowedSyncMethod;
451
- }
452
- }
453
-
454
- if (bidderRequest.uspConsent) {
455
- generalParams.us_privacy = bidderRequest.uspConsent;
456
- }
457
-
458
- if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) {
459
- generalParams.gdpr = bidderRequest.gdprConsent.gdprApplies;
460
- generalParams.gdpr_consent = bidderRequest.gdprConsent.consentString;
461
- }
462
-
463
- if (bidderRequest.gppConsent) {
464
- generalParams.gpp = bidderRequest.gppConsent.gppString;
465
- generalParams.gpp_sid = bidderRequest.gppConsent.applicableSections;
466
- } else if (bidderRequest.ortb2?.regs?.gpp) {
467
- generalParams.gpp = bidderRequest.ortb2.regs.gpp;
468
- generalParams.gpp_sid = bidderRequest.ortb2.regs.gpp_sid;
469
- }
470
-
471
- if (generalBidParams.ifa) {
472
- generalParams.ifa = generalBidParams.ifa;
473
- }
474
-
475
- if (generalObject.schain) {
476
- generalParams.schain = getSupplyChain(generalObject.schain);
477
- }
478
-
479
- if (bidderRequest && bidderRequest.refererInfo) {
480
- generalParams.referrer = deepAccess(bidderRequest, 'refererInfo.ref');
481
- generalParams.page_url = deepAccess(bidderRequest, 'refererInfo.page') || deepAccess(window, 'location.href');
482
- }
483
-
484
- return generalParams
485
- }
@@ -1,6 +1,7 @@
1
1
  import { logError, isEmpty, deepAccess, triggerPixel, logWarn, isArray } from '../src/utils.js';
2
2
  import {registerBidder} from '../src/adapters/bidderFactory.js';
3
3
  import {VIDEO} from '../src/mediaTypes.js';
4
+ import {getSupplyChain} from '../libraries/riseUtils/index.js';
4
5
 
5
6
  const BIDDER_CODE = 'telaria';
6
7
  const DOMAIN = 'tremorhub.com';
@@ -127,37 +128,6 @@ function getDefaultSrcPageUrl() {
127
128
  return encodeURIComponent(document.location.href);
128
129
  }
129
130
 
130
- function getEncodedValIfNotEmpty(val) {
131
- return (val !== '' && val !== undefined) ? encodeURIComponent(val) : '';
132
- }
133
-
134
- /**
135
- * Converts the schain object to a url param value. Please refer to
136
- * https://github.com/InteractiveAdvertisingBureau/openrtb/blob/master/supplychainobject.md
137
- * (schain for non ORTB section) for more information
138
- * @param schainObject
139
- * @returns {string}
140
- */
141
- function getSupplyChainAsUrlParam(schainObject) {
142
- if (isEmpty(schainObject)) {
143
- return '';
144
- }
145
-
146
- let scStr = `&schain=${schainObject.ver},${schainObject.complete}`;
147
-
148
- schainObject.nodes.forEach((node) => {
149
- scStr += '!';
150
- scStr += `${getEncodedValIfNotEmpty(node.asi)},`;
151
- scStr += `${getEncodedValIfNotEmpty(node.sid)},`;
152
- scStr += `${getEncodedValIfNotEmpty(node.hp)},`;
153
- scStr += `${getEncodedValIfNotEmpty(node.rid)},`;
154
- scStr += `${getEncodedValIfNotEmpty(node.name)},`;
155
- scStr += `${getEncodedValIfNotEmpty(node.domain)}`;
156
- });
157
-
158
- return scStr;
159
- }
160
-
161
131
  function getUrlParams(params, schainFromBidRequest) {
162
132
  let urlSuffix = '';
163
133
 
@@ -167,7 +137,7 @@ function getUrlParams(params, schainFromBidRequest) {
167
137
  urlSuffix += `&${key}=${params[key]}`;
168
138
  }
169
139
  }
170
- urlSuffix += getSupplyChainAsUrlParam(!isEmpty(schainFromBidRequest) ? schainFromBidRequest : params['schain']);
140
+ urlSuffix += getSupplyChain(!isEmpty(schainFromBidRequest) ? schainFromBidRequest : params['schain']);
171
141
  }
172
142
 
173
143
  return urlSuffix;