prebid.js 9.1.0 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/browsers.json +3 -3
  2. package/dist/33acrossAnalyticsAdapter.js +1 -1
  3. package/dist/33acrossBidAdapter.js +1 -1
  4. package/dist/33acrossIdSystem.js +1 -1
  5. package/dist/BTBidAdapter.js +1 -1
  6. package/dist/acuityadsBidAdapter.js +1 -1
  7. package/dist/adagioAnalyticsAdapter.js +1 -1
  8. package/dist/adagioBidAdapter.js +1 -1
  9. package/dist/adagioRtdProvider.js +1 -1
  10. package/dist/adagioUtils.js +1 -0
  11. package/dist/adgenerationBidAdapter.js +1 -1
  12. package/dist/admanBidAdapter.js +1 -1
  13. package/dist/adpod.js +1 -1
  14. package/dist/adprimeBidAdapter.js +1 -1
  15. package/dist/adqueryBidAdapter.js +1 -1
  16. package/dist/adrelevantisBidAdapter.js +1 -1
  17. package/dist/adstirBidAdapter.js +1 -1
  18. package/dist/adtrgtmeBidAdapter.js +1 -1
  19. package/dist/adxcgBidAdapter.js +1 -1
  20. package/dist/adyoulikeBidAdapter.js +1 -1
  21. package/dist/agmaAnalyticsAdapter.js +1 -1
  22. package/dist/ajaBidAdapter.js +1 -1
  23. package/dist/amxBidAdapter.js +1 -1
  24. package/dist/amxIdSystem.js +1 -1
  25. package/dist/appierAnalyticsAdapter.js +1 -1
  26. package/dist/appnexusBidAdapter.js +1 -1
  27. package/dist/appnexusUtils.js +1 -1
  28. package/dist/asoBidAdapter.js +1 -1
  29. package/dist/autoplayDetection.js +1 -1
  30. package/dist/axisBidAdapter.js +1 -1
  31. package/dist/axonixBidAdapter.js +1 -1
  32. package/dist/beyondmediaBidAdapter.js +1 -1
  33. package/dist/bidglassBidAdapter.js +1 -1
  34. package/dist/big-richmediaBidAdapter.js +1 -1
  35. package/dist/bliinkBidAdapter.js +1 -1
  36. package/dist/boldwinBidAdapter.js +1 -1
  37. package/dist/bridBidAdapter.js +1 -1
  38. package/dist/bridgewellBidAdapter.js +1 -1
  39. package/dist/brightMountainMediaBidAdapter.js +1 -1
  40. package/dist/carodaBidAdapter.js +1 -1
  41. package/dist/chtnwBidAdapter.js +1 -1
  42. package/dist/chunk-core.js +1 -1
  43. package/dist/compassBidAdapter.js +1 -1
  44. package/dist/concertBidAdapter.js +1 -1
  45. package/dist/connectadBidAdapter.js +1 -1
  46. package/dist/consumableBidAdapter.js +1 -1
  47. package/dist/contentexchangeBidAdapter.js +1 -1
  48. package/dist/conversantAnalyticsAdapter.js +1 -1
  49. package/dist/conversantBidAdapter.js +1 -1
  50. package/dist/craftBidAdapter.js +1 -1
  51. package/dist/criteoBidAdapter.js +1 -1
  52. package/dist/cwireBidAdapter.js +1 -1
  53. package/dist/dailymotionBidAdapter.js +1 -1
  54. package/dist/dependencies.json +78 -2
  55. package/dist/dspxBidAdapter.js +1 -1
  56. package/dist/dxkultureBidAdapter.js +1 -1
  57. package/dist/e_volutionBidAdapter.js +1 -1
  58. package/dist/emtvBidAdapter.js +1 -1
  59. package/dist/eplanningBidAdapter.js +1 -1
  60. package/dist/euidIdSystem.js +1 -1
  61. package/dist/exadsBidAdapter.js +1 -1
  62. package/dist/feedadBidAdapter.js +1 -1
  63. package/dist/finativeBidAdapter.js +1 -1
  64. package/dist/freewheel-sspBidAdapter.js +1 -1
  65. package/dist/globalsunBidAdapter.js +1 -1
  66. package/dist/gmosspBidAdapter.js +1 -1
  67. package/dist/goldbachBidAdapter.js +1 -1
  68. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  69. package/dist/greenbidsRtdProvider.js +1 -1
  70. package/dist/gridBidAdapter.js +1 -1
  71. package/dist/gumgumBidAdapter.js +1 -1
  72. package/dist/h12mediaBidAdapter.js +1 -1
  73. package/dist/hypelabBidAdapter.js +1 -1
  74. package/dist/id5IdSystem.js +1 -1
  75. package/dist/illuminBidAdapter.js +1 -1
  76. package/dist/imdsBidAdapter.js +1 -1
  77. package/dist/improvedigitalBidAdapter.js +1 -1
  78. package/dist/insticatorBidAdapter.js +1 -1
  79. package/dist/iqzoneBidAdapter.js +1 -1
  80. package/dist/ixBidAdapter.js +1 -1
  81. package/dist/jixieBidAdapter.js +1 -1
  82. package/dist/justpremiumBidAdapter.js +1 -1
  83. package/dist/kargoBidAdapter.js +1 -1
  84. package/dist/kimberliteBidAdapter.js +1 -1
  85. package/dist/kiviadsBidAdapter.js +1 -1
  86. package/dist/konduitAnalyticsAdapter.js +1 -1
  87. package/dist/krushmediaBidAdapter.js +1 -1
  88. package/dist/kueezBidAdapter.js +1 -1
  89. package/dist/kueezRtbBidAdapter.js +1 -1
  90. package/dist/lassoBidAdapter.js +1 -1
  91. package/dist/lifestreetBidAdapter.js +1 -1
  92. package/dist/liveIntentIdSystem.js +1 -1
  93. package/dist/logicadBidAdapter.js +1 -1
  94. package/dist/loglyliftBidAdapter.js +1 -1
  95. package/dist/loyalBidAdapter.js +1 -1
  96. package/dist/luceadBidAdapter.js +1 -1
  97. package/dist/lunamediahbBidAdapter.js +1 -1
  98. package/dist/magniteAnalyticsAdapter.js +1 -1
  99. package/dist/malltvAnalyticsAdapter.js +1 -1
  100. package/dist/marsmediaBidAdapter.js +1 -1
  101. package/dist/mathildeadsBidAdapter.js +1 -1
  102. package/dist/mediafuseBidAdapter.js +1 -1
  103. package/dist/mediasquareBidAdapter.js +1 -1
  104. package/dist/mgidBidAdapter.js +1 -1
  105. package/dist/mgidXBidAdapter.js +1 -1
  106. package/dist/minutemediaBidAdapter.js +1 -1
  107. package/dist/missenaBidAdapter.js +1 -1
  108. package/dist/mobfoxpbBidAdapter.js +1 -1
  109. package/dist/mobianRtdProvider.js +1 -1
  110. package/dist/nexx360BidAdapter.js +1 -1
  111. package/dist/nobidAnalyticsAdapter.js +1 -1
  112. package/dist/nobidBidAdapter.js +1 -1
  113. package/dist/not-for-prod/prebid.js +187 -185
  114. package/dist/oguryBidAdapter.js +1 -1
  115. package/dist/onetagBidAdapter.js +1 -1
  116. package/dist/ooloAnalyticsAdapter.js +1 -1
  117. package/dist/openwebBidAdapter.js +1 -1
  118. package/dist/openxBidAdapter.js +1 -1
  119. package/dist/optidigitalBidAdapter.js +1 -1
  120. package/dist/ortbConverter.js +1 -1
  121. package/dist/outbrainBidAdapter.js +1 -1
  122. package/dist/ozoneBidAdapter.js +1 -1
  123. package/dist/paapi.js +1 -1
  124. package/dist/pgamsspBidAdapter.js +1 -1
  125. package/dist/pixfutureBidAdapter.js +1 -1
  126. package/dist/playdigoBidAdapter.js +1 -1
  127. package/dist/prebidServerBidAdapter.js +1 -1
  128. package/dist/pubCircleBidAdapter.js +1 -1
  129. package/dist/publinkIdSystem.js +1 -1
  130. package/dist/publirBidAdapter.js +1 -1
  131. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  132. package/dist/pubmaticBidAdapter.js +1 -1
  133. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  134. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  135. package/dist/pxyzBidAdapter.js +1 -1
  136. package/dist/qtBidAdapter.js +1 -1
  137. package/dist/quantcastBidAdapter.js +1 -1
  138. package/dist/raynRtdProvider.js +1 -1
  139. package/dist/readpeakBidAdapter.js +1 -1
  140. package/dist/relaidoBidAdapter.js +1 -1
  141. package/dist/retailspotBidAdapter.js +1 -1
  142. package/dist/rhythmoneBidAdapter.js +1 -1
  143. package/dist/riseBidAdapter.js +1 -1
  144. package/dist/rubiconBidAdapter.js +1 -1
  145. package/dist/seedingAllianceBidAdapter.js +1 -1
  146. package/dist/seedtagBidAdapter.js +1 -1
  147. package/dist/setupadBidAdapter.js +1 -1
  148. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  149. package/dist/sharethroughBidAdapter.js +1 -1
  150. package/dist/shinezBidAdapter.js +1 -1
  151. package/dist/shinezRtbBidAdapter.js +1 -1
  152. package/dist/smaatoBidAdapter.js +1 -1
  153. package/dist/smartadserverBidAdapter.js +1 -1
  154. package/dist/smartxBidAdapter.js +1 -1
  155. package/dist/smartytechBidAdapter.js +1 -1
  156. package/dist/smilewantedBidAdapter.js +1 -1
  157. package/dist/sonobiBidAdapter.js +1 -1
  158. package/dist/sovrnBidAdapter.js +1 -1
  159. package/dist/sspBCBidAdapter.js +1 -1
  160. package/dist/stnBidAdapter.js +1 -1
  161. package/dist/stvBidAdapter.js +1 -1
  162. package/dist/sublimeBidAdapter.js +1 -1
  163. package/dist/taboolaBidAdapter.js +1 -1
  164. package/dist/tagorasBidAdapter.js +1 -1
  165. package/dist/targetVideoBidAdapter.js +1 -1
  166. package/dist/teadsBidAdapter.js +1 -1
  167. package/dist/teqblazeUtils.js +1 -0
  168. package/dist/themoneytizerBidAdapter.js +1 -1
  169. package/dist/topicsFpdModule.js +1 -1
  170. package/dist/trionBidAdapter.js +1 -1
  171. package/dist/tripleliftBidAdapter.js +1 -1
  172. package/dist/ttdBidAdapter.js +1 -1
  173. package/dist/twistDigitalBidAdapter.js +1 -1
  174. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  175. package/dist/uid2IdSystem.js +1 -1
  176. package/dist/underdogmediaBidAdapter.js +1 -1
  177. package/dist/undertoneBidAdapter.js +1 -1
  178. package/dist/unrulyBidAdapter.js +1 -1
  179. package/dist/vidazooBidAdapter.js +1 -1
  180. package/dist/videobyteBidAdapter.js +1 -1
  181. package/dist/visiblemeasuresBidAdapter.js +1 -1
  182. package/dist/visxBidAdapter.js +1 -1
  183. package/dist/vuukleBidAdapter.js +1 -1
  184. package/dist/widespaceBidAdapter.js +1 -1
  185. package/dist/winrBidAdapter.js +1 -1
  186. package/dist/yahooAdsBidAdapter.js +1 -1
  187. package/dist/yieldmoBidAdapter.js +1 -1
  188. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  189. package/integrationExamples/gpt/raynRtdProvider_example.html +1 -0
  190. package/libraries/adagioUtils/adagioUtils.js +35 -0
  191. package/libraries/appnexusUtils/anUtils.js +1 -0
  192. package/libraries/autoplayDetection/autoplay.js +8 -1
  193. package/libraries/ortbConverter/converter.js +1 -1
  194. package/libraries/teqblazeUtils/bidderUtils.js +253 -0
  195. package/modules/.submodules.json +1 -0
  196. package/modules/acuityadsBidAdapter.js +5 -203
  197. package/modules/adagioBidAdapter.js +1 -17
  198. package/modules/adagioRtdProvider.js +41 -51
  199. package/modules/adagioRtdProvider.md +1 -0
  200. package/modules/admanBidAdapter.js +31 -188
  201. package/modules/adprimeBidAdapter.js +28 -165
  202. package/modules/axisBidAdapter.js +33 -165
  203. package/modules/beyondmediaBidAdapter.js +5 -189
  204. package/modules/bliinkBidAdapter.js +3 -31
  205. package/modules/boldwinBidAdapter.js +21 -159
  206. package/modules/ceeIdSystem.js +1 -1
  207. package/modules/compassBidAdapter.js +5 -198
  208. package/modules/contentexchangeBidAdapter.js +5 -200
  209. package/modules/conversantBidAdapter.js +1 -0
  210. package/modules/e_volutionBidAdapter.js +4 -186
  211. package/modules/emtvBidAdapter.js +5 -198
  212. package/modules/globalsunBidAdapter.js +5 -199
  213. package/modules/id5IdSystem.js +31 -2
  214. package/modules/id5IdSystem.md +67 -2
  215. package/modules/iqzoneBidAdapter.js +5 -224
  216. package/modules/kiviadsBidAdapter.js +5 -199
  217. package/modules/krushmediaBidAdapter.js +25 -143
  218. package/modules/loyalBidAdapter.js +4 -178
  219. package/modules/lunamediahbBidAdapter.js +5 -118
  220. package/modules/mathildeadsBidAdapter.js +5 -198
  221. package/modules/mgidXBidAdapter.js +14 -207
  222. package/modules/mobfoxpbBidAdapter.js +4 -135
  223. package/modules/mobianRtdProvider.js +2 -2
  224. package/modules/nobidAnalyticsAdapter.js +2 -3
  225. package/modules/ozoneBidAdapter.js +117 -58
  226. package/modules/paapi.js +2 -1
  227. package/modules/pgamsspBidAdapter.js +5 -240
  228. package/modules/playdigoBidAdapter.js +4 -186
  229. package/modules/prebidServerBidAdapter/index.js +9 -2
  230. package/modules/pubCircleBidAdapter.js +5 -218
  231. package/modules/pubmaticAnalyticsAdapter.js +21 -8
  232. package/modules/pubxaiAnalyticsAdapter.js +1 -5
  233. package/modules/qtBidAdapter.js +5 -224
  234. package/modules/raynRtdProvider.js +36 -3
  235. package/modules/seedtagBidAdapter.js +1 -0
  236. package/modules/setupadBidAdapter.js +58 -140
  237. package/modules/smartytechBidAdapter.js +7 -2
  238. package/modules/topicsFpdModule.js +1 -1
  239. package/modules/uid2IdSystem.js +0 -1
  240. package/modules/uid2IdSystem_shared.js +0 -1
  241. package/modules/visiblemeasuresBidAdapter.js +5 -199
  242. package/package.json +1 -1
  243. package/src/auction.js +5 -63
  244. package/src/utils/focusTimeout.js +41 -0
  245. package/src/utils/ttlCollection.js +2 -1
  246. package/src/utils.js +42 -0
  247. package/src/videoCache.js +72 -0
  248. package/test/mocks/videoCacheStub.js +1 -1
  249. package/test/spec/auctionmanager_spec.js +16 -1
  250. package/test/spec/libraries/teqblazeUtils/bidderUtils_spec.js +519 -0
  251. package/test/spec/modules/acuityadsBidAdapter_spec.js +79 -43
  252. package/test/spec/modules/adagioRtdProvider_spec.js +62 -1
  253. package/test/spec/modules/admanBidAdapter_spec.js +370 -247
  254. package/test/spec/modules/adprimeBidAdapter_spec.js +225 -78
  255. package/test/spec/modules/axisBidAdapter_spec.js +78 -14
  256. package/test/spec/modules/beyondmediaBidAdapter_spec.js +80 -18
  257. package/test/spec/modules/bliinkBidAdapter_spec.js +8 -2
  258. package/test/spec/modules/boldwinBidAdapter_spec.js +221 -75
  259. package/test/spec/modules/compassBidAdapter_spec.js +130 -16
  260. package/test/spec/modules/contentexchangeBidAdapter_spec.js +134 -21
  261. package/test/spec/modules/conversantBidAdapter_spec.js +7 -0
  262. package/test/spec/modules/e_volutionBidAdapter_spec.js +65 -3
  263. package/test/spec/modules/emtvBidAdapter_spec.js +131 -16
  264. package/test/spec/modules/globalsunBidAdapter_spec.js +130 -16
  265. package/test/spec/modules/id5IdSystem_spec.js +79 -3
  266. package/test/spec/modules/iqzoneBidAdapter_spec.js +66 -12
  267. package/test/spec/modules/kiviadsBidAdapter_spec.js +131 -20
  268. package/test/spec/modules/krushmediaBidAdapter_spec.js +272 -90
  269. package/test/spec/modules/loyalBidAdapter_spec.js +114 -14
  270. package/test/spec/modules/lunamediahbBidAdapter_spec.js +221 -87
  271. package/test/spec/modules/mathildeadsBidAdapter_spec.js +87 -18
  272. package/test/spec/modules/mgidXBidAdapter_spec.js +11 -3
  273. package/test/spec/modules/mobfoxpbBidAdapter_spec.js +229 -91
  274. package/test/spec/modules/ozoneBidAdapter_spec.js +192 -22
  275. package/test/spec/modules/paapi_spec.js +5 -5
  276. package/test/spec/modules/pgamsspBidAdapter_spec.js +83 -16
  277. package/test/spec/modules/playdigoBidAdapter_spec.js +38 -9
  278. package/test/spec/modules/prebidServerBidAdapter_spec.js +14 -0
  279. package/test/spec/modules/pubCircleBidAdapter_spec.js +82 -17
  280. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +52 -5
  281. package/test/spec/modules/qtBidAdapter_spec.js +15 -3
  282. package/test/spec/modules/raynRtdProvider_spec.js +25 -0
  283. package/test/spec/modules/seedtagBidAdapter_spec.js +2 -0
  284. package/test/spec/modules/setupadBidAdapter_spec.js +124 -97
  285. package/test/spec/modules/smartytechBidAdapter_spec.js +5 -1
  286. package/test/spec/modules/topicsFpdModule_spec.js +43 -59
  287. package/test/spec/modules/visiblemeasuresBidAdapter_spec.js +130 -16
  288. package/test/spec/ortbConverter/converter_spec.js +7 -3
  289. package/test/spec/unit/utils/focusTimeout_spec.js +60 -0
  290. package/test/spec/videoCache_spec.js +56 -53
@@ -1,238 +1,19 @@
1
- import { logMessage, deepAccess } from '../src/utils.js';
2
- import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
3
1
  import { registerBidder } from '../src/adapters/bidderFactory.js';
4
2
  import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
5
- import { config } from '../src/config.js';
3
+ import { isBidRequestValid, buildRequests, interpretResponse, getUserSyncs } from '../libraries/teqblazeUtils/bidderUtils.js';
6
4
 
7
5
  const BIDDER_CODE = 'qt';
8
6
  const AD_URL = 'https://endpoint1.qt.io/pbjs';
9
7
  const SYNC_URL = 'https://cs.qt.io';
10
8
 
11
- function isBidResponseValid(bid) {
12
- if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
13
- return false;
14
- }
15
-
16
- switch (bid.mediaType) {
17
- case BANNER:
18
- return Boolean(bid.width && bid.height && bid.ad);
19
- case VIDEO:
20
- return Boolean(bid.vastUrl || bid.vastXml);
21
- case NATIVE:
22
- return Boolean(bid.native && bid.native.impressionTrackers && bid.native.impressionTrackers.length);
23
- default:
24
- return false;
25
- }
26
- }
27
-
28
- function getPlacementReqData(bid) {
29
- const { params, bidId, mediaTypes, transactionId, userIdAsEids } = bid;
30
- const schain = bid.schain || {};
31
- const { placementId, endpointId } = params;
32
- const bidfloor = getBidFloor(bid);
33
-
34
- const placement = {
35
- bidId,
36
- schain,
37
- bidfloor
38
- };
39
-
40
- if (placementId) {
41
- placement.placementId = placementId;
42
- placement.type = 'publisher';
43
- } else if (endpointId) {
44
- placement.endpointId = endpointId;
45
- placement.type = 'network';
46
- }
47
-
48
- if (mediaTypes && mediaTypes[BANNER]) {
49
- placement.adFormat = BANNER;
50
- placement.sizes = mediaTypes[BANNER].sizes;
51
- } else if (mediaTypes && mediaTypes[VIDEO]) {
52
- placement.adFormat = VIDEO;
53
- placement.playerSize = mediaTypes[VIDEO].playerSize;
54
- placement.minduration = mediaTypes[VIDEO].minduration;
55
- placement.maxduration = mediaTypes[VIDEO].maxduration;
56
- placement.mimes = mediaTypes[VIDEO].mimes;
57
- placement.protocols = mediaTypes[VIDEO].protocols;
58
- placement.startdelay = mediaTypes[VIDEO].startdelay;
59
- placement.plcmt = mediaTypes[VIDEO].plcmt;
60
- placement.skip = mediaTypes[VIDEO].skip;
61
- placement.skipafter = mediaTypes[VIDEO].skipafter;
62
- placement.minbitrate = mediaTypes[VIDEO].minbitrate;
63
- placement.maxbitrate = mediaTypes[VIDEO].maxbitrate;
64
- placement.delivery = mediaTypes[VIDEO].delivery;
65
- placement.playbackmethod = mediaTypes[VIDEO].playbackmethod;
66
- placement.api = mediaTypes[VIDEO].api;
67
- placement.linearity = mediaTypes[VIDEO].linearity;
68
- } else if (mediaTypes && mediaTypes[NATIVE]) {
69
- placement.native = mediaTypes[NATIVE];
70
- placement.adFormat = NATIVE;
71
- }
72
-
73
- if (transactionId) {
74
- placement.ext = placement.ext || {};
75
- placement.ext.tid = transactionId;
76
- }
77
-
78
- if (userIdAsEids && userIdAsEids.length) {
79
- placement.eids = userIdAsEids;
80
- }
81
-
82
- return placement;
83
- }
84
-
85
- function getBidFloor(bid) {
86
- try {
87
- const bidFloor = bid.getFloor({
88
- currency: 'USD',
89
- mediaType: '*',
90
- size: '*',
91
- });
92
- return bidFloor.floor;
93
- } catch (err) {
94
- return 0;
95
- }
96
- }
97
-
98
9
  export const spec = {
99
10
  code: BIDDER_CODE,
100
11
  supportedMediaTypes: [BANNER, VIDEO, NATIVE],
101
12
 
102
- isBidRequestValid: (bid = {}) => {
103
- const { params, bidId, mediaTypes } = bid;
104
- let valid = Boolean(bidId && params && (params.placementId || params.endpointId));
105
-
106
- if (mediaTypes && mediaTypes[BANNER]) {
107
- valid = valid && Boolean(mediaTypes[BANNER] && mediaTypes[BANNER].sizes);
108
- } else if (mediaTypes && mediaTypes[VIDEO]) {
109
- valid = valid && Boolean(mediaTypes[VIDEO] && mediaTypes[VIDEO].playerSize);
110
- } else if (mediaTypes && mediaTypes[NATIVE]) {
111
- valid = valid && Boolean(mediaTypes[NATIVE]);
112
- } else {
113
- valid = false;
114
- }
115
- return valid;
116
- },
117
-
118
- buildRequests: (validBidRequests = [], bidderRequest = {}) => {
119
- // convert Native ORTB definition to old-style prebid native definition
120
- validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
121
-
122
- let deviceWidth = 0;
123
- let deviceHeight = 0;
124
-
125
- let winLocation;
126
- try {
127
- const winTop = window.top;
128
- deviceWidth = winTop.screen.width;
129
- deviceHeight = winTop.screen.height;
130
- winLocation = winTop.location;
131
- } catch (e) {
132
- logMessage(e);
133
- winLocation = window.location;
134
- }
135
-
136
- const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.page;
137
- let refferLocation;
138
- try {
139
- refferLocation = refferUrl && new URL(refferUrl);
140
- } catch (e) {
141
- logMessage(e);
142
- }
143
-
144
- let location = refferLocation || winLocation;
145
- const language = (navigator && navigator.language) ? navigator.language.split('-')[0] : '';
146
- const host = location.host;
147
- const page = location.pathname;
148
- const secure = location.protocol === 'https:' ? 1 : 0;
149
- const placements = [];
150
- const request = {
151
- deviceWidth,
152
- deviceHeight,
153
- language,
154
- secure,
155
- host,
156
- page,
157
- placements,
158
- coppa: deepAccess(bidderRequest, 'ortb2.regs.coppa') ? 1 : 0,
159
- tmax: bidderRequest.timeout
160
- };
161
-
162
- if (bidderRequest.uspConsent) {
163
- request.ccpa = bidderRequest.uspConsent;
164
- }
165
-
166
- if (bidderRequest.gdprConsent) {
167
- request.gdpr = {
168
- consentString: bidderRequest.gdprConsent.consentString
169
- };
170
- }
171
-
172
- if (bidderRequest.gppConsent) {
173
- request.gpp = bidderRequest.gppConsent.gppString;
174
- request.gpp_sid = bidderRequest.gppConsent.applicableSections;
175
- } else if (bidderRequest.ortb2?.regs?.gpp) {
176
- request.gpp = bidderRequest.ortb2.regs.gpp;
177
- request.gpp_sid = bidderRequest.ortb2.regs.gpp_sid;
178
- }
179
-
180
- const len = validBidRequests.length;
181
- for (let i = 0; i < len; i++) {
182
- const bid = validBidRequests[i];
183
- placements.push(getPlacementReqData(bid));
184
- }
185
-
186
- return {
187
- method: 'POST',
188
- url: AD_URL,
189
- data: request
190
- };
191
- },
192
-
193
- interpretResponse: (serverResponse) => {
194
- let response = [];
195
- for (let i = 0; i < serverResponse.body.length; i++) {
196
- let resItem = serverResponse.body[i];
197
- if (isBidResponseValid(resItem)) {
198
- const advertiserDomains = resItem.adomain && resItem.adomain.length ? resItem.adomain : [];
199
- resItem.meta = { ...resItem.meta, advertiserDomains };
200
-
201
- response.push(resItem);
202
- }
203
- }
204
- return response;
205
- },
206
-
207
- getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent, gppConsent) => {
208
- let syncType = syncOptions.iframeEnabled ? 'iframe' : 'image';
209
- let syncUrl = SYNC_URL + `/${syncType}?pbjs=1`;
210
-
211
- if (gdprConsent && gdprConsent.consentString) {
212
- if (typeof gdprConsent.gdprApplies === 'boolean') {
213
- syncUrl += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
214
- } else {
215
- syncUrl += `&gdpr=0&gdpr_consent=${gdprConsent.consentString}`;
216
- }
217
- }
218
-
219
- if (uspConsent && uspConsent.consentString) {
220
- syncUrl += `&ccpa_consent=${uspConsent.consentString}`;
221
- }
222
-
223
- if (gppConsent?.gppString && gppConsent?.applicableSections?.length) {
224
- syncUrl += '&gpp=' + gppConsent.gppString;
225
- syncUrl += '&gpp_sid=' + gppConsent.applicableSections.join(',');
226
- }
227
-
228
- const coppa = config.getConfig('coppa') ? 1 : 0;
229
- syncUrl += `&coppa=${coppa}`;
230
-
231
- return [{
232
- type: syncType,
233
- url: syncUrl
234
- }];
235
- }
13
+ isBidRequestValid: isBidRequestValid(),
14
+ buildRequests: buildRequests(AD_URL),
15
+ interpretResponse,
16
+ getUserSyncs: getUserSyncs(SYNC_URL)
236
17
  };
237
18
 
238
19
  registerBidder(spec);
@@ -14,6 +14,7 @@ import { deepAccess, deepSetValue, logError, logMessage, mergeDeep } from '../sr
14
14
  const MODULE_NAME = 'realTimeData';
15
15
  const SUBMODULE_NAME = 'rayn';
16
16
  const RAYN_TCF_ID = 1220;
17
+ const RAYN_PERSONA_TAXONOMY_ID = 103015;
17
18
  const LOG_PREFIX = 'RaynJS: ';
18
19
  export const SEGMENTS_RESOLVER = 'rayn.io';
19
20
  export const RAYN_LOCAL_STORAGE_KEY = 'rayn-segtax';
@@ -77,6 +78,32 @@ export function generateOrtbDataObject(segtax, segment, maxTier) {
77
78
  };
78
79
  }
79
80
 
81
+ /**
82
+ * Create and return ORTB2 object with segtax and personaIds
83
+ * @param {number} segtax
84
+ * @param {Array} personaIds
85
+ * @return {Array}
86
+ */
87
+ export function generatePersonaOrtbDataObject(segtax, personaIds) {
88
+ const segmentIds = [];
89
+
90
+ try {
91
+ segmentIds.push(...personaIds.map((id) => {
92
+ return { id };
93
+ }))
94
+ } catch (error) {
95
+ logError(LOG_PREFIX, error);
96
+ }
97
+
98
+ return {
99
+ name: SEGMENTS_RESOLVER,
100
+ ext: {
101
+ segtax,
102
+ },
103
+ segment: segmentIds,
104
+ };
105
+ }
106
+
80
107
  /**
81
108
  * Generates checksum
82
109
  * @param {string} url
@@ -127,8 +154,14 @@ export function setSegmentsAsBidderOrtb2(bidConfig, bidders, integrationConfig,
127
154
  deepSetValue(raynOrtb2, 'site.content.data', raynContentData);
128
155
  }
129
156
 
157
+ const raynUserData = [];
130
158
  if (integrationConfig.iabAudienceCategories.v1_1.enabled && segments[4]) {
131
- const raynUserData = [generateOrtbDataObject(4, segments[4], integrationConfig.iabAudienceCategories.v1_1.tier)];
159
+ raynUserData.push(generateOrtbDataObject(4, segments[4], integrationConfig.iabAudienceCategories.v1_1.tier));
160
+ }
161
+ if (segments[RAYN_PERSONA_TAXONOMY_ID]) {
162
+ raynUserData.push(generatePersonaOrtbDataObject(RAYN_PERSONA_TAXONOMY_ID, segments[RAYN_PERSONA_TAXONOMY_ID]));
163
+ }
164
+ if (raynUserData.length > 0) {
132
165
  deepSetValue(raynOrtb2, 'user.data', raynUserData);
133
166
  }
134
167
 
@@ -163,8 +196,8 @@ function alterBidRequests(reqBidsConfigObj, callback, config, userConsent) {
163
196
  segments[checksum] || (segments[4] &&
164
197
  integrationConfig.iabAudienceCategories.v1_1.enabled &&
165
198
  !integrationConfig.iabContentCategories.v2_2.enabled &&
166
- !integrationConfig.iabContentCategories.v3_0.enabled
167
- )
199
+ !integrationConfig.iabContentCategories.v3_0.enabled) ||
200
+ segments[RAYN_PERSONA_TAXONOMY_ID]
168
201
  )) {
169
202
  logMessage(LOG_PREFIX, `Segtax data from localStorage: ${JSON.stringify(segments)}`);
170
203
  setSegmentsAsBidderOrtb2(reqBidsConfigObj, bidders, integrationConfig, segments, checksum);
@@ -119,6 +119,7 @@ function buildBidRequest(validBidRequest) {
119
119
  const bidRequest = {
120
120
  id: validBidRequest.bidId,
121
121
  transactionId: validBidRequest.ortb2Imp?.ext?.tid,
122
+ gpid: validBidRequest.ortb2Imp?.ext?.gpid,
122
123
  sizes: validBidRequest.sizes,
123
124
  supplyTypes: mediaTypes,
124
125
  adUnitId: params.adUnitId,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  _each,
3
- createTrackPixelHtml,
4
- deepAccess,
5
3
  isStr,
6
4
  getBidIdParameter,
7
5
  triggerPixel,
8
6
  logWarn,
7
+ deepSetValue,
9
8
  } from '../src/utils.js';
10
9
  import { registerBidder } from '../src/adapters/bidderFactory.js';
11
10
  import { BANNER } from '../src/mediaTypes.js';
11
+ import { ortbConverter } from '../libraries/ortbConverter/converter.js';
12
12
 
13
13
  const BIDDER_CODE = 'setupad';
14
14
  const ENDPOINT = 'https://prebid.setupad.io/openrtb2/auction';
@@ -16,11 +16,39 @@ const SYNC_ENDPOINT = 'https://cookie.stpd.cloud/sync?';
16
16
  const REPORT_ENDPOINT = 'https://adapter-analytics.setupad.io/api/adapter-analytics?';
17
17
  const GVLID = 1241;
18
18
  const TIME_TO_LIVE = 360;
19
- const biddersCreativeIds = {};
20
-
21
- function getEids(bidRequest) {
22
- if (deepAccess(bidRequest, 'userIdAsEids')) return bidRequest.userIdAsEids;
23
- }
19
+ export const biddersCreativeIds = {}; // export only for tests
20
+ const NET_REVENUE = true;
21
+ const TEST_REQUEST = 0; // used only for testing
22
+
23
+ const converter = ortbConverter({
24
+ context: {
25
+ netRevenue: NET_REVENUE,
26
+ ttl: TIME_TO_LIVE,
27
+ },
28
+ imp(buildImp, bidRequest, context) {
29
+ const imp = buildImp(bidRequest, context);
30
+ deepSetValue(
31
+ imp,
32
+ 'ext.prebid.storedrequest.id',
33
+ getBidIdParameter('placement_id', bidRequest.params)
34
+ );
35
+ return imp;
36
+ },
37
+ request(buildRequest, imps, bidderRequest, context) {
38
+ const request = buildRequest(imps, bidderRequest, context);
39
+ deepSetValue(request, 'test', TEST_REQUEST);
40
+ deepSetValue(
41
+ request,
42
+ 'ext.prebid.storedrequest.id',
43
+ getBidIdParameter(
44
+ 'account_id',
45
+ bidderRequest.bids.find((bid) => bid.hasOwnProperty('params')).params
46
+ )
47
+ );
48
+ deepSetValue(request, 'setupad', 'adapter');
49
+ return request;
50
+ },
51
+ });
24
52
 
25
53
  export const spec = {
26
54
  code: BIDDER_CODE,
@@ -37,97 +65,17 @@ export const spec = {
37
65
  },
38
66
 
39
67
  buildRequests: function (validBidRequests, bidderRequest) {
40
- const requests = [];
41
-
42
- _each(validBidRequests, function (bid) {
43
- const id = getBidIdParameter('placement_id', bid.params);
44
- const accountId = getBidIdParameter('account_id', bid.params);
45
- const auctionId = bid.auctionId;
46
- const bidId = bid.bidId;
47
- const eids = getEids(bid) || undefined;
48
- let sizes = bid.sizes;
49
- if (sizes && !Array.isArray(sizes[0])) sizes = [sizes];
50
-
51
- const site = {
52
- page: bidderRequest?.refererInfo?.page,
53
- ref: bidderRequest?.refererInfo?.ref,
54
- domain: bidderRequest?.refererInfo?.domain,
55
- };
56
- const device = {
57
- w: bidderRequest?.ortb2?.device?.w,
58
- h: bidderRequest?.ortb2?.device?.h,
59
- };
60
-
61
- const payload = {
62
- id: bid?.bidderRequestId,
63
- ext: {
64
- prebid: {
65
- storedrequest: {
66
- id: accountId || 'default',
67
- },
68
- },
69
- },
70
- user: { ext: { eids } },
71
- device,
72
- site,
73
- imp: [],
74
- };
75
-
76
- const imp = {
77
- id: bid.adUnitCode,
78
- ext: {
79
- prebid: {
80
- storedrequest: { id },
81
- },
82
- },
83
- };
84
-
85
- if (deepAccess(bid, 'mediaTypes.banner')) {
86
- imp.banner = {
87
- format: (sizes || []).map((s) => {
88
- return { w: s[0], h: s[1] };
89
- }),
90
- };
91
- }
92
-
93
- payload.imp.push(imp);
94
-
95
- const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
96
- const uspConsent = bidderRequest && bidderRequest.uspConsent;
97
-
98
- if (gdprConsent || uspConsent) {
99
- payload.regs = { ext: {} };
100
-
101
- if (uspConsent) payload.regs.ext.us_privacy = uspConsent;
102
-
103
- if (gdprConsent) {
104
- if (typeof gdprConsent.gdprApplies !== 'undefined') {
105
- payload.regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0;
106
- }
107
-
108
- if (typeof gdprConsent.consentString !== 'undefined') {
109
- payload.user.ext.consent = gdprConsent.consentString;
110
- }
111
- }
112
- }
113
- const params = bid.params;
114
-
115
- requests.push({
116
- method: 'POST',
117
- url: ENDPOINT,
118
- data: JSON.stringify(payload),
119
- options: {
120
- contentType: 'text/plain',
121
- withCredentials: true,
122
- },
123
-
124
- bidId,
125
- params,
126
- auctionId,
127
- });
128
- });
129
-
130
- return requests;
68
+ const data = converter.toORTB({ validBidRequests, bidderRequest });
69
+
70
+ return {
71
+ method: 'POST',
72
+ url: ENDPOINT,
73
+ data,
74
+ options: {
75
+ contentType: 'text/plain',
76
+ withCredentials: true,
77
+ },
78
+ };
131
79
  },
132
80
 
133
81
  interpretResponse: function (serverResponse, bidRequest) {
@@ -141,40 +89,22 @@ export const spec = {
141
89
  return [];
142
90
  }
143
91
 
144
- const serverBody = serverResponse.body;
145
- const bidResponses = [];
146
-
147
- _each(serverBody.seatbid, (res) => {
92
+ // set a seat for creativeId for triggerPixel url
93
+ _each(serverResponse.body.seatbid, (res) => {
148
94
  _each(res.bid, (bid) => {
149
- const requestId = bidRequest.bidId;
150
- const params = bidRequest.params;
151
- const { ad, adUrl } = getAd(bid);
152
-
153
- const bidResponse = {
154
- requestId,
155
- params,
156
- cpm: bid.price,
157
- width: bid.w,
158
- height: bid.h,
159
- creativeId: bid.id,
160
- currency: serverBody.cur,
161
- netRevenue: true,
162
- ttl: TIME_TO_LIVE,
163
- meta: {
164
- advertiserDomains: bid.adomain || [],
165
- },
166
- };
167
-
168
- // set a seat for creativeId for triggerPixel url
169
- biddersCreativeIds[bidResponse.creativeId] = res.seat;
170
-
171
- bidResponse.ad = ad;
172
- bidResponse.adUrl = adUrl;
173
- bidResponses.push(bidResponse);
95
+ biddersCreativeIds[bid.crid] = res.seat;
174
96
  });
175
97
  });
176
98
 
177
- return bidResponses;
99
+ // used for a test case "should update biddersCreativeIds correctly" to return early and not throw ORTB error
100
+ if (serverResponse.testCase === 1) return;
101
+
102
+ const bids = converter.fromORTB({
103
+ response: serverResponse.body,
104
+ request: bidRequest.data,
105
+ }).bids;
106
+
107
+ return bids;
178
108
  },
179
109
 
180
110
  getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
@@ -261,16 +191,4 @@ function getBidders(serverResponse) {
261
191
  }
262
192
  }
263
193
 
264
- function getAd(bid) {
265
- const { adm, nurl } = bid;
266
- let ad = adm;
267
-
268
- if (nurl) {
269
- const trackingPixel = createTrackPixelHtml(decodeURIComponent(nurl));
270
- ad += trackingPixel;
271
- }
272
-
273
- return { ad };
274
- }
275
-
276
194
  registerBidder(spec);
@@ -127,14 +127,19 @@ export const spec = {
127
127
  creativeId: response.creativeId,
128
128
  netRevenue: true,
129
129
  currency: response.currency,
130
- mediaType: BANNER
131
- }
130
+ mediaType: BANNER,
131
+ meta: {}
132
+ };
132
133
 
133
134
  if (response.mediaType === VIDEO) {
134
135
  bidObject.vastXml = response.ad;
135
136
  bidObject.mediaType = VIDEO;
136
137
  }
137
138
 
139
+ if (response.meta) {
140
+ bidObject.meta = response.meta;
141
+ }
142
+
138
143
  return bidObject;
139
144
  },
140
145
 
@@ -130,7 +130,7 @@ export function processFpd(config, {global}, {data = topicsData} = {}) {
130
130
  export function getCachedTopics() {
131
131
  let cachedTopicData = [];
132
132
  const topics = config.getConfig('userSync.topics');
133
- const bidderList = topics.bidders || [];
133
+ const bidderList = topics?.bidders || [];
134
134
  let storedSegments = new Map(safeJSONParse(coreStorage.getDataFromLocalStorage(topicStorageName)));
135
135
  storedSegments && storedSegments.forEach((value, cachedBidder) => {
136
136
  // Check bidder exist in config for cached bidder data and then only retrieve the cached data
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-console */
2
1
  /**
3
2
  * This module adds uid2 ID support to the User ID module
4
3
  * The {@link module:modules/userId} module is required.
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-console */
2
1
  import { ajax } from '../src/ajax.js';
3
2
  import { cyrb53Hash } from '../src/utils.js';
4
3