prebid.js 7.14.0 → 7.16.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 (239) hide show
  1. package/.circleci/config.yml +3 -0
  2. package/dist/1plusXRtdProvider.js +1 -1
  3. package/dist/33acrossBidAdapter.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adfBidAdapter.js +1 -1
  7. package/dist/adgenerationBidAdapter.js +1 -1
  8. package/dist/adkernelAdnBidAdapter.js +1 -1
  9. package/dist/adkernelBidAdapter.js +1 -1
  10. package/dist/adlooxAdServerVideo.js +1 -1
  11. package/dist/adlooxRtdProvider.js +1 -1
  12. package/dist/adrelevantisBidAdapter.js +1 -1
  13. package/dist/adtrgtmeBidAdapter.js +1 -1
  14. package/dist/adtrueBidAdapter.js +1 -1
  15. package/dist/adxcgBidAdapter.js +1 -1
  16. package/dist/airgridRtdProvider.js +1 -1
  17. package/dist/ajaBidAdapter.js +1 -1
  18. package/dist/amxBidAdapter.js +1 -1
  19. package/dist/amxIdSystem.js +1 -1
  20. package/dist/aolBidAdapter.js +1 -1
  21. package/dist/appierAnalyticsAdapter.js +1 -1
  22. package/dist/appnexusBidAdapter.js +1 -1
  23. package/dist/asoBidAdapter.js +1 -1
  24. package/dist/axonixBidAdapter.js +1 -1
  25. package/dist/beachfrontBidAdapter.js +1 -1
  26. package/dist/bidglassBidAdapter.js +1 -1
  27. package/dist/big-richmediaBidAdapter.js +1 -1
  28. package/dist/bizzclickBidAdapter.js +1 -1
  29. package/dist/bliinkBidAdapter.js +1 -1
  30. package/dist/bluebillywigBidAdapter.js +1 -1
  31. package/dist/brandmetricsRtdProvider.js +1 -1
  32. package/dist/bridgewellBidAdapter.js +1 -1
  33. package/dist/brightMountainMediaBidAdapter.js +1 -1
  34. package/dist/brightcomBidAdapter.js +1 -1
  35. package/dist/browsiRtdProvider.js +1 -1
  36. package/dist/categoryTranslation.js +1 -1
  37. package/dist/concertBidAdapter.js +1 -1
  38. package/dist/connectadBidAdapter.js +1 -1
  39. package/dist/consentManagement.js +1 -1
  40. package/dist/consentManagementUsp.js +1 -1
  41. package/dist/consumableBidAdapter.js +1 -1
  42. package/dist/conversantBidAdapter.js +1 -1
  43. package/dist/cpmstarBidAdapter.js +1 -1
  44. package/dist/craftBidAdapter.js +1 -1
  45. package/dist/criteoBidAdapter.js +1 -1
  46. package/dist/currency.js +1 -1
  47. package/dist/dataControllerModule.js +1 -1
  48. package/dist/dchain.js +1 -1
  49. package/dist/deepintentBidAdapter.js +1 -1
  50. package/dist/dependencies.json +3 -0
  51. package/dist/dgkeywordRtdProvider.js +1 -1
  52. package/dist/dianomiBidAdapter.js +1 -1
  53. package/dist/distroscaleBidAdapter.js +1 -1
  54. package/dist/dspxBidAdapter.js +1 -1
  55. package/dist/eplanningBidAdapter.js +1 -1
  56. package/dist/etargetBidAdapter.js +1 -1
  57. package/dist/feedadBidAdapter.js +1 -1
  58. package/dist/finativeBidAdapter.js +1 -1
  59. package/dist/fpdModule.js +1 -1
  60. package/dist/gamoshiBidAdapter.js +1 -1
  61. package/dist/glimpseBidAdapter.js +1 -1
  62. package/dist/gmosspBidAdapter.js +1 -1
  63. package/dist/goldbachBidAdapter.js +1 -1
  64. package/dist/gothamadsBidAdapter.js +1 -1
  65. package/dist/gridBidAdapter.js +1 -1
  66. package/dist/gridNMBidAdapter.js +1 -1
  67. package/dist/gumgumBidAdapter.js +1 -1
  68. package/dist/h12mediaBidAdapter.js +1 -1
  69. package/dist/iasRtdProvider.js +1 -1
  70. package/dist/id5IdSystem.js +1 -1
  71. package/dist/imRtdProvider.js +1 -1
  72. package/dist/impactifyBidAdapter.js +1 -1
  73. package/dist/improvedigitalBidAdapter.js +1 -1
  74. package/dist/inmarBidAdapter.js +1 -1
  75. package/dist/insticatorBidAdapter.js +1 -1
  76. package/dist/ixBidAdapter.js +1 -1
  77. package/dist/justpremiumBidAdapter.js +1 -1
  78. package/dist/konduitAnalyticsAdapter.js +1 -1
  79. package/dist/kueezBidAdapter.js +1 -1
  80. package/dist/lassoBidAdapter.js +1 -1
  81. package/dist/lifestreetBidAdapter.js +1 -1
  82. package/dist/liveIntentAnalyticsAdapter.js +1 -0
  83. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  84. package/dist/logicadBidAdapter.js +1 -1
  85. package/dist/loglyliftBidAdapter.js +1 -1
  86. package/dist/luponmediaBidAdapter.js +1 -1
  87. package/dist/malltvAnalyticsAdapter.js +1 -1
  88. package/dist/marsmediaBidAdapter.js +1 -1
  89. package/dist/mass.js +1 -1
  90. package/dist/mediafuseBidAdapter.js +1 -1
  91. package/dist/mediakeysBidAdapter.js +1 -1
  92. package/dist/mediasniperBidAdapter.js +1 -1
  93. package/dist/mediasquareBidAdapter.js +1 -1
  94. package/dist/mgidBidAdapter.js +1 -1
  95. package/dist/minutemediaBidAdapter.js +1 -1
  96. package/dist/multibid.js +1 -1
  97. package/dist/naveggIdSystem.js +1 -1
  98. package/dist/newspassidBidAdapter.js +1 -1
  99. package/dist/nextMillenniumBidAdapter.js +1 -1
  100. package/dist/not-for-prod/prebid.js +172 -171
  101. package/dist/oguryBidAdapter.js +1 -1
  102. package/dist/oneKeyRtdProvider.js +1 -1
  103. package/dist/onetagBidAdapter.js +1 -1
  104. package/dist/ooloAnalyticsAdapter.js +1 -1
  105. package/dist/openxBidAdapter.js +1 -1
  106. package/dist/openxOrtbBidAdapter.js +1 -1
  107. package/dist/operaadsBidAdapter.js +1 -1
  108. package/dist/outbrainBidAdapter.js +1 -1
  109. package/dist/ozoneBidAdapter.js +1 -1
  110. package/dist/parrableIdSystem.js +1 -1
  111. package/dist/permutiveRtdProvider.js +1 -1
  112. package/dist/pixfutureBidAdapter.js +1 -1
  113. package/dist/prebid-core.js +2 -2
  114. package/dist/prebidServerBidAdapter.js +1 -1
  115. package/dist/priceFloors.js +1 -1
  116. package/dist/pubCommonId.js +1 -1
  117. package/dist/pubgeniusBidAdapter.js +1 -1
  118. package/dist/publinkIdSystem.js +1 -1
  119. package/dist/pubmaticBidAdapter.js +1 -1
  120. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  121. package/dist/pubwiseBidAdapter.js +1 -1
  122. package/dist/pubxBidAdapter.js +1 -1
  123. package/dist/pxyzBidAdapter.js +1 -1
  124. package/dist/quantcastBidAdapter.js +1 -1
  125. package/dist/readpeakBidAdapter.js +1 -1
  126. package/dist/relaidoBidAdapter.js +1 -1
  127. package/dist/rhythmoneBidAdapter.js +1 -1
  128. package/dist/riseBidAdapter.js +1 -1
  129. package/dist/rtdModule.js +1 -1
  130. package/dist/rubiconAnalyticsAdapter.js +1 -1
  131. package/dist/rubiconBidAdapter.js +1 -1
  132. package/dist/seedingAllianceBidAdapter.js +1 -1
  133. package/dist/seedtagBidAdapter.js +1 -1
  134. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  135. package/dist/sharethroughBidAdapter.js +1 -1
  136. package/dist/shinezBidAdapter.js +1 -1
  137. package/dist/sirdataRtdProvider.js +1 -1
  138. package/dist/smaatoBidAdapter.js +1 -1
  139. package/dist/smartadserverBidAdapter.js +1 -1
  140. package/dist/smartxBidAdapter.js +1 -1
  141. package/dist/smilewantedBidAdapter.js +1 -1
  142. package/dist/sonobiBidAdapter.js +1 -1
  143. package/dist/sovrnAnalyticsAdapter.js +1 -1
  144. package/dist/sovrnBidAdapter.js +1 -1
  145. package/dist/spotxBidAdapter.js +1 -1
  146. package/dist/sspBCBidAdapter.js +1 -1
  147. package/dist/stroeerCoreBidAdapter.js +1 -1
  148. package/dist/sublimeBidAdapter.js +1 -1
  149. package/dist/synacormediaBidAdapter.js +1 -1
  150. package/dist/targetVideoBidAdapter.js +1 -1
  151. package/dist/teadsBidAdapter.js +1 -1
  152. package/dist/trionBidAdapter.js +1 -1
  153. package/dist/tripleliftBidAdapter.js +1 -1
  154. package/dist/ttdBidAdapter.js +1 -1
  155. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  156. package/dist/ucfunnelBidAdapter.js +1 -1
  157. package/dist/underdogmediaBidAdapter.js +1 -1
  158. package/dist/undertoneBidAdapter.js +1 -1
  159. package/dist/userId.js +1 -1
  160. package/dist/vidazooBidAdapter.js +1 -1
  161. package/dist/videobyteBidAdapter.js +1 -1
  162. package/dist/viewability.js +1 -1
  163. package/dist/visxBidAdapter.js +1 -1
  164. package/dist/vuukleBidAdapter.js +1 -1
  165. package/dist/weboramaRtdProvider.js +1 -1
  166. package/dist/widespaceBidAdapter.js +1 -1
  167. package/dist/winrBidAdapter.js +1 -1
  168. package/dist/yahoosspBidAdapter.js +1 -1
  169. package/dist/yieldliftBidAdapter.js +1 -1
  170. package/dist/yieldmoBidAdapter.js +1 -1
  171. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  172. package/dist/zeta_global_sspBidAdapter.js +1 -1
  173. package/modules/amxBidAdapter.js +98 -78
  174. package/modules/appnexusBidAdapter.js +73 -12
  175. package/modules/categoryTranslation.js +9 -8
  176. package/modules/consentManagement.js +4 -2
  177. package/modules/consentManagementUsp.js +17 -14
  178. package/modules/cpmstarBidAdapter.js +2 -1
  179. package/modules/currency.js +4 -3
  180. package/modules/dataControllerModule/index.js +4 -3
  181. package/modules/dchain.js +3 -2
  182. package/modules/dianomiBidAdapter.js +17 -14
  183. package/modules/dianomiBidAdapter.md +1 -1
  184. package/modules/feedadBidAdapter.js +40 -8
  185. package/modules/fpdModule/index.js +3 -2
  186. package/modules/iasRtdProvider.js +17 -3
  187. package/modules/ixBidAdapter.js +2 -5
  188. package/modules/liveIntentAnalyticsAdapter.js +148 -0
  189. package/modules/liveIntentAnalyticsAdapter.md +22 -0
  190. package/modules/mass.js +5 -3
  191. package/modules/multibid/index.js +4 -2
  192. package/modules/naveggIdSystem.js +53 -22
  193. package/modules/nextMillenniumBidAdapter.js +168 -55
  194. package/modules/openxOrtbBidAdapter.js +1 -1
  195. package/modules/prebidServerBidAdapter/index.js +18 -4
  196. package/modules/priceFloors.js +5 -4
  197. package/modules/pubCommonId.js +3 -2
  198. package/modules/rtdModule/index.js +3 -2
  199. package/modules/sharethroughBidAdapter.js +8 -6
  200. package/modules/spotxBidAdapter.js +1 -0
  201. package/modules/stroeerCoreBidAdapter.js +129 -92
  202. package/modules/stroeerCoreBidAdapter.md +52 -14
  203. package/modules/teadsBidAdapter.js +32 -10
  204. package/modules/ucfunnelBidAdapter.js +9 -10
  205. package/modules/userId/index.js +73 -48
  206. package/modules/viewability.js +2 -170
  207. package/package.json +3 -3
  208. package/src/adapterManager.js +21 -13
  209. package/src/adapters/bidderFactory.js +28 -6
  210. package/src/auction.js +17 -4
  211. package/src/auctionManager.js +5 -0
  212. package/src/constants.json +2 -0
  213. package/src/native.js +5 -2
  214. package/src/prebid.js +52 -23
  215. package/src/secureCreatives.js +1 -1
  216. package/src/utils/perfMetrics.js +386 -0
  217. package/src/utils.js +1 -1
  218. package/test/helpers/testing-utils.js +4 -3
  219. package/test/spec/modules/adriverIdSystem_spec.js +7 -3
  220. package/test/spec/modules/amxBidAdapter_spec.js +250 -192
  221. package/test/spec/modules/appnexusBidAdapter_spec.js +61 -6
  222. package/test/spec/modules/consentManagementUsp_spec.js +6 -2
  223. package/test/spec/modules/dianomiBidAdapter_spec.js +326 -6
  224. package/test/spec/modules/feedadBidAdapter_spec.js +147 -11
  225. package/test/spec/modules/iasRtdProvider_spec.js +3 -1
  226. package/test/spec/modules/ixBidAdapter_spec.js +0 -64
  227. package/test/spec/modules/liveIntentAnalyticsAdapter_spec.js +297 -0
  228. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +103 -1
  229. package/test/spec/modules/openxOrtbBidAdapter_spec.js +31 -0
  230. package/test/spec/modules/sharethroughBidAdapter_spec.js +23 -2
  231. package/test/spec/modules/spotxBidAdapter_spec.js +6 -0
  232. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +315 -33
  233. package/test/spec/modules/teadsBidAdapter_spec.js +65 -11
  234. package/test/spec/modules/ucfunnelBidAdapter_spec.js +24 -10
  235. package/test/spec/native_spec.js +11 -0
  236. package/test/spec/unit/utils/perfMetrics_spec.js +394 -0
  237. package/wdio.conf.js +1 -0
  238. package/modules/viewability.md +0 -87
  239. package/test/spec/modules/viewability_spec.js +0 -280
@@ -1,50 +1,52 @@
1
- import * as utils from 'src/utils.js';
2
- import { createEidsArray } from 'modules/userId/eids.js';
3
1
  import { expect } from 'chai';
4
2
  import { spec } from 'modules/amxBidAdapter.js';
3
+ import { createEidsArray } from 'modules/userId/eids.js';
5
4
  import { BANNER, VIDEO } from 'src/mediaTypes.js';
6
- import { config } from 'src/config.js';
5
+ import * as utils from 'src/utils.js';
7
6
 
8
7
  const sampleRequestId = '82c91e127a9b93e';
9
- const sampleDisplayAd = (additionalImpressions) => `<script src='https://assets.a-mo.net/tmode.v1.js'></script>${additionalImpressions}`;
8
+ const sampleDisplayAd = `<script src='https://assets.a-mo.net/tmode.v1.js'></script>`;
10
9
  const sampleDisplayCRID = '78827819';
11
10
  // minimal example vast
12
- const sampleVideoAd = (addlImpression) => `
11
+ const sampleVideoAd = (addlImpression) =>
12
+ `
13
13
  <?xml version="1.0" encoding="UTF-8" ?><VAST version="2.0"><Ad id="128a6.44d74.46b3"><InLine><Error><![CDATA[http://example.net/hbx/verr?e=]]></Error><Impression><![CDATA[http://example.net/hbx/vimp?lid=test&aid=testapp]]></Impression><Creatives><Creative sequence="1"><Linear><Duration>00:00:15</Duration><TrackingEvents><Tracking event="firstQuartile"><![CDATA[https://example.com?event=first_quartile]]></Tracking></TrackingEvents><VideoClicks><ClickThrough><![CDATA[http://example.com]]></ClickThrough></VideoClicks><MediaFiles><MediaFile delivery="progressive" width="16" height="9" type="video/mp4" bitrate="800"><![CDATA[https://example.com/media.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives>${addlImpression}</InLine></Ad></VAST>
14
- `.replace(/\n+/g, '')
15
-
16
- const embeddedTrackingPixel = `https://1x1.a-mo.net/hbx/g_impression?A=sample&B=20903`;
17
- const sampleNurl = 'https://example.exchange/nurl';
14
+ `.replace(/\n+/g, '');
18
15
 
19
16
  const sampleFPD = {
20
17
  site: {
21
18
  keywords: 'sample keywords',
22
19
  ext: {
23
20
  data: {
24
- pageType: 'article'
25
- }
26
- }
21
+ pageType: 'article',
22
+ },
23
+ },
27
24
  },
28
25
  user: {
29
26
  gender: 'O',
30
27
  yob: 1982,
31
- }
28
+ },
32
29
  };
33
30
 
34
31
  const sampleBidderRequest = {
35
32
  gdprConsent: {
36
33
  gdprApplies: true,
37
34
  consentString: utils.getUniqueIdentifierStr(),
38
- vendorData: {}
35
+ vendorData: {},
39
36
  },
40
37
  auctionId: utils.getUniqueIdentifierStr(),
41
38
  uspConsent: '1YYY',
42
39
  refererInfo: {
43
40
  location: 'https://www.prebid.org',
41
+ site: 'prebid.org',
44
42
  topmostLocation: 'https://www.prebid.org',
45
- canonicalUrl: 'https://www.prebid.org/the/link/to/the/page'
43
+ page: 'https://www.prebid.org/the/link/to/the/page',
46
44
  },
47
- ortb2: sampleFPD
45
+ ortb2: sampleFPD,
46
+ };
47
+
48
+ const sampleImpExt = {
49
+ testKey: 'testValue',
48
50
  };
49
51
 
50
52
  const sampleBidRequestBase = {
@@ -52,20 +54,29 @@ const sampleBidRequestBase = {
52
54
  params: {
53
55
  endpoint: 'https://httpbin.org/post',
54
56
  },
57
+ ortb2Imp: {
58
+ ext: sampleImpExt,
59
+ },
55
60
  sizes: [[320, 50]],
56
61
  getFloor(params) {
57
- if (params.size == null || params.currency == null || params.mediaType == null) {
58
- throw new Error(`getFloor called with incomplete params: ${JSON.stringify(params)}`)
62
+ if (
63
+ params.size == null ||
64
+ params.currency == null ||
65
+ params.mediaType == null
66
+ ) {
67
+ throw new Error(
68
+ `getFloor called with incomplete params: ${JSON.stringify(params)}`
69
+ );
59
70
  }
60
71
  return {
61
72
  floor: 0.5,
62
- currency: 'USD'
63
- }
73
+ currency: 'USD',
74
+ };
64
75
  },
65
76
  mediaTypes: {
66
77
  [BANNER]: {
67
- sizes: [[300, 250]]
68
- }
78
+ sizes: [[300, 250]],
79
+ },
69
80
  },
70
81
  adUnitCode: 'div-gpt-ad-example',
71
82
  transactionId: utils.getUniqueIdentifierStr(),
@@ -75,13 +86,15 @@ const sampleBidRequestBase = {
75
86
 
76
87
  const schainConfig = {
77
88
  ver: '1.0',
78
- nodes: [{
79
- asi: 'greatnetwork.exchange',
80
- sid: '000001',
81
- hp: 1,
82
- rid: 'bid_request_1',
83
- domain: 'publisher.com'
84
- }]
89
+ nodes: [
90
+ {
91
+ asi: 'greatnetwork.exchange',
92
+ sid: '000001',
93
+ hp: 1,
94
+ rid: 'bid_request_1',
95
+ domain: 'publisher.com',
96
+ },
97
+ ],
85
98
  };
86
99
 
87
100
  const sampleBidRequestVideo = {
@@ -94,89 +107,93 @@ const sampleBidRequestVideo = {
94
107
  sizes: [[360, 250]],
95
108
  context: 'adpod',
96
109
  adPodDurationSec: 90,
97
- contentMode: 'live'
98
- }
99
- }
110
+ contentMode: 'live',
111
+ },
112
+ },
100
113
  };
101
114
 
102
115
  const sampleServerResponse = {
103
- 'p': {
104
- 'hreq': ['https://1x1.a-mo.net/hbx/g_sync?partner=test', 'https://1x1.a-mo.net/hbx/g_syncf?__st=iframe']
116
+ p: {
117
+ hreq: [
118
+ 'https://1x1.a-mo.net/hbx/g_sync?partner=test',
119
+ 'https://1x1.a-mo.net/hbx/g_syncf?__st=iframe',
120
+ ],
105
121
  },
106
- 'r': {
122
+ r: {
107
123
  [sampleRequestId]: [
108
124
  {
109
- 'b': [
125
+ b: [
110
126
  {
111
- 'adid': '78827819',
112
- 'adm': sampleDisplayAd(''),
113
- 'adomain': [
114
- 'example.com'
115
- ],
116
- 'crid': sampleDisplayCRID,
117
- 'ext': {
118
- 'himp': [
119
- embeddedTrackingPixel
120
- ],
121
- },
122
- 'nurl': sampleNurl,
123
- 'h': 600,
124
- 'id': '2014691335735134254',
125
- 'impid': '1',
126
- 'exp': 90,
127
- 'price': 0.25,
128
- 'w': 300
127
+ adid: '78827819',
128
+ adm: sampleDisplayAd,
129
+ adomain: ['example.com'],
130
+ crid: sampleDisplayCRID,
131
+ h: 600,
132
+ id: '2014691335735134254',
133
+ impid: '1',
134
+ exp: 90,
135
+ price: 0.25,
136
+ w: 300,
129
137
  },
130
138
  {
131
- 'adid': '222976952',
132
- 'adm': sampleVideoAd(''),
133
- 'adomain': [
134
- 'example.com'
135
- ],
136
- 'crid': sampleDisplayCRID,
137
- 'ext': {
138
- 'himp': [
139
- embeddedTrackingPixel
140
- ],
141
- },
142
- 'nurl': sampleNurl,
143
- 'h': 1,
144
- 'id': '7735706981389902829',
145
- 'impid': '1',
146
- 'exp': 90,
147
- 'price': 0.25,
148
- 'w': 1
139
+ adid: '222976952',
140
+ adm: sampleVideoAd(''),
141
+ adomain: ['example.com'],
142
+ crid: sampleDisplayCRID,
143
+ ext: {},
144
+ h: 1,
145
+ id: '7735706981389902829',
146
+ impid: '1',
147
+ exp: 90,
148
+ price: 0.25,
149
+ w: 1,
149
150
  },
150
151
  ],
151
- }
152
- ]
152
+ },
153
+ ],
153
154
  },
154
- }
155
+ };
155
156
 
156
157
  describe('AmxBidAdapter', () => {
157
158
  describe('isBidRequestValid', () => {
158
159
  it('endpoint must be an optional string', () => {
159
- expect(spec.isBidRequestValid({params: { endpoint: 1 }})).to.equal(false)
160
- expect(spec.isBidRequestValid({params: { endpoint: 'test' }})).to.equal(true)
160
+ expect(spec.isBidRequestValid({ params: { endpoint: 1 } })).to.equal(
161
+ false
162
+ );
163
+ expect(spec.isBidRequestValid({ params: { endpoint: 'test' } })).to.equal(
164
+ true
165
+ );
161
166
  });
162
167
 
163
168
  it('tagId is an optional string', () => {
164
- expect(spec.isBidRequestValid({params: { tagId: 1 }})).to.equal(false)
165
- expect(spec.isBidRequestValid({params: { tagId: 'test' }})).to.equal(true)
169
+ expect(spec.isBidRequestValid({ params: { tagId: 1 } })).to.equal(false);
170
+ expect(spec.isBidRequestValid({ params: { tagId: 'test' } })).to.equal(
171
+ true
172
+ );
166
173
  });
167
174
 
168
175
  it('testMode is an optional truthy value', () => {
169
- expect(spec.isBidRequestValid({params: { testMode: 1 }})).to.equal(true)
170
- expect(spec.isBidRequestValid({params: { testMode: 'true' }})).to.equal(true)
176
+ expect(spec.isBidRequestValid({ params: { testMode: 1 } })).to.equal(
177
+ true
178
+ );
179
+ expect(spec.isBidRequestValid({ params: { testMode: 'true' } })).to.equal(
180
+ true
181
+ );
171
182
  // ignore invalid values (falsy)
172
- expect(spec.isBidRequestValid({params: { testMode: 'non-truthy-invalid-value' }})).to.equal(true)
173
- expect(spec.isBidRequestValid({params: { testMode: false }})).to.equal(true)
183
+ expect(
184
+ spec.isBidRequestValid({
185
+ params: { testMode: 'non-truthy-invalid-value' },
186
+ })
187
+ ).to.equal(true);
188
+ expect(spec.isBidRequestValid({ params: { testMode: false } })).to.equal(
189
+ true
190
+ );
174
191
  });
175
192
 
176
193
  it('none of the params are required', () => {
177
- expect(spec.isBidRequestValid({})).to.equal(true)
194
+ expect(spec.isBidRequestValid({})).to.equal(true);
178
195
  });
179
- })
196
+ });
180
197
  describe('getUserSync', () => {
181
198
  it('will only sync from valid server responses', () => {
182
199
  const syncs = spec.getUserSyncs({ iframeEnabled: true });
@@ -184,43 +201,62 @@ describe('AmxBidAdapter', () => {
184
201
  });
185
202
 
186
203
  it('will return valid syncs from a server response', () => {
187
- const syncs = spec.getUserSyncs({ iframeEnabled: true }, [{body: sampleServerResponse}]);
204
+ const syncs = spec.getUserSyncs({ iframeEnabled: true }, [
205
+ { body: sampleServerResponse },
206
+ ]);
188
207
  expect(syncs.length).to.equal(2);
189
208
  expect(syncs[0].type).to.equal('image');
190
209
  expect(syncs[1].type).to.equal('iframe');
191
210
  });
192
211
 
193
212
  it('will filter out iframe syncs based on options', () => {
194
- const syncs = spec.getUserSyncs({ iframeEnabled: false }, [{body: sampleServerResponse}, {body: sampleServerResponse}]);
213
+ const syncs = spec.getUserSyncs({ iframeEnabled: false }, [
214
+ { body: sampleServerResponse },
215
+ { body: sampleServerResponse },
216
+ ]);
195
217
  expect(syncs.length).to.equal(2);
196
- expect(syncs).to.satisfy((allSyncs) => allSyncs.every((sync) => sync.type === 'image'))
218
+ expect(syncs).to.satisfy((allSyncs) =>
219
+ allSyncs.every((sync) => sync.type === 'image')
220
+ );
197
221
  });
198
222
  });
199
223
 
200
224
  describe('buildRequests', () => {
201
225
  it('will default to prebid.a-mo.net endpoint', () => {
202
226
  const { url } = spec.buildRequests([], sampleBidderRequest);
203
- expect(url).to.equal('https://prebid.a-mo.net/a/c')
227
+ expect(url).to.equal('https://prebid.a-mo.net/a/c');
204
228
  });
205
229
 
206
230
  it('will read the prebid version & global', () => {
207
- const { data: { V: prebidVersion, vg: prebidGlobal } } = spec.buildRequests([{
208
- ...sampleBidRequestBase,
209
- params: {
210
- testMode: true
211
- }
212
- }], sampleBidderRequest);
213
- expect(prebidVersion).to.equal('$prebid.version$')
214
- expect(prebidGlobal).to.equal('$$PREBID_GLOBAL$$')
231
+ const {
232
+ data: { V: prebidVersion, vg: prebidGlobal },
233
+ } = spec.buildRequests(
234
+ [
235
+ {
236
+ ...sampleBidRequestBase,
237
+ params: {
238
+ testMode: true,
239
+ },
240
+ },
241
+ ],
242
+ sampleBidderRequest
243
+ );
244
+ expect(prebidVersion).to.equal('$prebid.version$');
245
+ expect(prebidGlobal).to.equal('$$PREBID_GLOBAL$$');
215
246
  });
216
247
 
217
248
  it('reads test mode from the first bid request', () => {
218
- const { data } = spec.buildRequests([{
219
- ...sampleBidRequestBase,
220
- params: {
221
- testMode: true
222
- }
223
- }], sampleBidderRequest);
249
+ const { data } = spec.buildRequests(
250
+ [
251
+ {
252
+ ...sampleBidRequestBase,
253
+ params: {
254
+ testMode: true,
255
+ },
256
+ },
257
+ ],
258
+ sampleBidderRequest
259
+ );
224
260
  expect(data.tm).to.equal(true);
225
261
  });
226
262
 
@@ -231,9 +267,9 @@ describe('AmxBidAdapter', () => {
231
267
  location: null,
232
268
  topmostLocation: null,
233
269
  ref: 'http://search-traffic-source.com',
234
- }
270
+ },
235
271
  });
236
- expect(data.do).to.equal('localhost')
272
+ expect(data.do).to.equal('localhost');
237
273
  expect(data.re).to.equal('http://search-traffic-source.com');
238
274
  });
239
275
 
@@ -244,48 +280,59 @@ describe('AmxBidAdapter', () => {
244
280
  location: null,
245
281
  topmostLocation: 'http://top-site.com',
246
282
  ref: 'http://search-traffic-source.com',
247
- }
283
+ },
248
284
  });
249
285
  expect(data.do).to.equal('top-site.com');
250
286
  expect(data.re).to.equal('http://search-traffic-source.com');
251
287
  });
252
288
 
253
289
  it('handles referer data and GDPR, USP Consent, COPPA', () => {
254
- const { data } = spec.buildRequests([sampleBidRequestBase], sampleBidderRequest);
290
+ const { data } = spec.buildRequests(
291
+ [sampleBidRequestBase],
292
+ sampleBidderRequest
293
+ );
255
294
  delete data.m; // don't deal with "m" in this test
256
- expect(data.gs).to.equal(sampleBidderRequest.gdprConsent.gdprApplies)
257
- expect(data.gc).to.equal(sampleBidderRequest.gdprConsent.consentString)
258
- expect(data.usp).to.equal(sampleBidderRequest.uspConsent)
259
- expect(data.cpp).to.equal(0)
295
+ expect(data.gs).to.equal(sampleBidderRequest.gdprConsent.gdprApplies);
296
+ expect(data.gc).to.equal(sampleBidderRequest.gdprConsent.consentString);
297
+ expect(data.usp).to.equal(sampleBidderRequest.uspConsent);
298
+ expect(data.cpp).to.equal(0);
260
299
  });
261
300
 
262
301
  it('will forward bid request count & wins count data', () => {
263
- const bidderRequestsCount = Math.floor(Math.random() * 100)
264
- const bidderWinsCount = Math.floor(Math.random() * 100)
265
- const { data } = spec.buildRequests([{
266
- ...sampleBidRequestBase,
267
- bidderRequestsCount,
268
- bidderWinsCount
269
- }], sampleBidderRequest);
302
+ const bidderRequestsCount = Math.floor(Math.random() * 100);
303
+ const bidderWinsCount = Math.floor(Math.random() * 100);
304
+ const { data } = spec.buildRequests(
305
+ [
306
+ {
307
+ ...sampleBidRequestBase,
308
+ bidderRequestsCount,
309
+ bidderWinsCount,
310
+ },
311
+ ],
312
+ sampleBidderRequest
313
+ );
270
314
 
271
- expect(data.brc).to.equal(bidderRequestsCount)
272
- expect(data.bwc).to.equal(bidderWinsCount)
273
- expect(data.trc).to.equal(0)
315
+ expect(data.brc).to.equal(bidderRequestsCount);
316
+ expect(data.bwc).to.equal(bidderWinsCount);
317
+ expect(data.trc).to.equal(0);
274
318
  });
275
319
  it('will forward first-party data', () => {
276
- const { data } = spec.buildRequests([sampleBidRequestBase], sampleBidderRequest);
277
- expect(data.fpd2).to.deep.equal(sampleFPD)
320
+ const { data } = spec.buildRequests(
321
+ [sampleBidRequestBase],
322
+ sampleBidderRequest
323
+ );
324
+ expect(data.fpd2).to.deep.equal(sampleFPD);
278
325
  });
279
326
 
280
327
  it('will collect & forward RTI user IDs', () => {
281
- const randomRTI = `greatRTI${Math.floor(Math.random() * 100)}`
328
+ const randomRTI = `greatRTI${Math.floor(Math.random() * 100)}`;
282
329
  const userId = {
283
330
  britepoolid: 'sample-britepool',
284
331
  criteoId: 'sample-criteo',
285
- digitrustid: {data: {id: 'sample-digitrust'}},
286
- id5id: {uid: 'sample-id5'},
332
+ digitrustid: { data: { id: 'sample-digitrust' } },
333
+ id5id: { uid: 'sample-id5' },
287
334
  idl_env: 'sample-liveramp',
288
- lipb: {lipbid: 'sample-liveintent'},
335
+ lipb: { lipbid: 'sample-liveintent' },
289
336
  netId: 'sample-netid',
290
337
  parrableId: { eid: 'sample-parrable' },
291
338
  pubcid: 'sample-pubcid',
@@ -296,71 +343,74 @@ describe('AmxBidAdapter', () => {
296
343
  const eids = createEidsArray(userId);
297
344
  const bid = {
298
345
  ...sampleBidRequestBase,
299
- userIdAsEids: eids
346
+ userIdAsEids: eids,
300
347
  };
301
348
 
302
349
  const { data } = spec.buildRequests([bid, bid], sampleBidderRequest);
303
- expect(data.eids).to.deep.equal(eids)
350
+ expect(data.eids).to.deep.equal(eids);
304
351
  });
305
352
 
306
353
  it('can build a banner request', () => {
307
- const { method, url, data } = spec.buildRequests([sampleBidRequestBase, {
308
- ...sampleBidRequestBase,
309
- bidId: sampleRequestId + '_2',
310
- params: {
311
- ...sampleBidRequestBase.params,
312
- tagId: 'example'
313
- }
314
- }], sampleBidderRequest)
354
+ const { method, url, data } = spec.buildRequests(
355
+ [
356
+ sampleBidRequestBase,
357
+ {
358
+ ...sampleBidRequestBase,
359
+ bidId: sampleRequestId + '_2',
360
+ params: {
361
+ ...sampleBidRequestBase.params,
362
+ tagId: 'example',
363
+ },
364
+ },
365
+ ],
366
+ sampleBidderRequest
367
+ );
315
368
 
316
- expect(url).to.equal(sampleBidRequestBase.params.endpoint)
369
+ expect(url).to.equal(sampleBidRequestBase.params.endpoint);
317
370
  expect(method).to.equal('POST');
318
371
  expect(Object.keys(data.m).length).to.equal(2);
319
372
  expect(data.m[sampleRequestId]).to.deep.equal({
320
373
  av: true,
321
374
  au: 'div-gpt-ad-example',
322
375
  vd: {},
323
- ms: [
324
- [[320, 50]],
325
- [[300, 250]],
326
- []
327
- ],
376
+ ms: [[[320, 50]], [[300, 250]], []],
328
377
  aw: 300,
329
378
  sc: {},
330
379
  ah: 250,
331
380
  tf: 0,
332
381
  f: 0.5,
333
- vr: false
382
+ vr: false,
383
+ rtb: {
384
+ ext: sampleImpExt,
385
+ },
334
386
  });
335
387
  expect(data.m[sampleRequestId + '_2']).to.deep.equal({
336
388
  av: true,
337
389
  aw: 300,
338
390
  au: 'div-gpt-ad-example',
339
391
  sc: {},
340
- ms: [
341
- [[320, 50]],
342
- [[300, 250]],
343
- []
344
- ],
392
+ ms: [[[320, 50]], [[300, 250]], []],
345
393
  i: 'example',
346
394
  ah: 250,
347
395
  vd: {},
348
396
  tf: 0,
349
397
  f: 0.5,
350
398
  vr: false,
399
+ rtb: {
400
+ ext: sampleImpExt,
401
+ },
351
402
  });
352
403
  });
353
404
 
354
405
  it('can build a video request', () => {
355
- const { data } = spec.buildRequests([sampleBidRequestVideo], sampleBidderRequest);
406
+ const { data } = spec.buildRequests(
407
+ [sampleBidRequestVideo],
408
+ sampleBidderRequest
409
+ );
356
410
  expect(Object.keys(data.m).length).to.equal(1);
357
411
  expect(data.m[sampleRequestId + '_video']).to.deep.equal({
358
412
  au: 'div-gpt-ad-example',
359
- ms: [
360
- [[300, 150]],
361
- [],
362
- [[360, 250]]
363
- ],
413
+ ms: [[[300, 150]], [], [[360, 250]]],
364
414
  av: true,
365
415
  aw: 360,
366
416
  ah: 250,
@@ -369,11 +419,14 @@ describe('AmxBidAdapter', () => {
369
419
  sizes: [[360, 250]],
370
420
  context: 'adpod',
371
421
  adPodDurationSec: 90,
372
- contentMode: 'live'
422
+ contentMode: 'live',
373
423
  },
374
424
  tf: 0,
375
425
  f: 0.5,
376
- vr: true
426
+ rtb: {
427
+ ext: sampleImpExt,
428
+ },
429
+ vr: true,
377
430
  });
378
431
  });
379
432
  });
@@ -397,18 +450,21 @@ describe('AmxBidAdapter', () => {
397
450
  aw: 300,
398
451
  ah: 250,
399
452
  },
400
- }
401
- }
453
+ },
454
+ },
402
455
  };
403
456
 
404
457
  it('will handle a nobid response', () => {
405
- const parsed = spec.interpretResponse({ body: '' }, baseRequest)
406
- expect(parsed).to.eql([])
458
+ const parsed = spec.interpretResponse({ body: '' }, baseRequest);
459
+ expect(parsed).to.eql([]);
407
460
  });
408
461
 
409
462
  it('can parse a display ad', () => {
410
- const parsed = spec.interpretResponse({ body: sampleServerResponse }, baseRequest)
411
- expect(parsed.length).to.equal(2)
463
+ const parsed = spec.interpretResponse(
464
+ { body: sampleServerResponse },
465
+ baseRequest
466
+ );
467
+ expect(parsed.length).to.equal(2);
412
468
 
413
469
  // we should have display, video, display
414
470
  expect(parsed[0]).to.deep.equal({
@@ -421,16 +477,16 @@ describe('AmxBidAdapter', () => {
421
477
  width: 300,
422
478
  height: 600, // from the bid itself
423
479
  ttl: 90,
424
- ad: sampleDisplayAd(
425
- `<img src="${embeddedTrackingPixel}" width="0" height="0"/>` +
426
- `<img src="${sampleNurl}" width="0" height="0"/>`
427
- ),
480
+ ad: sampleDisplayAd,
428
481
  });
429
482
  });
430
483
 
431
484
  it('can parse a video ad', () => {
432
- const parsed = spec.interpretResponse({ body: sampleServerResponse }, baseRequest)
433
- expect(parsed.length).to.equal(2)
485
+ const parsed = spec.interpretResponse(
486
+ { body: sampleServerResponse },
487
+ baseRequest
488
+ );
489
+ expect(parsed.length).to.equal(2);
434
490
  expect(parsed[1]).to.deep.equal({
435
491
  ...baseBidResponse,
436
492
  meta: {
@@ -453,9 +509,9 @@ describe('AmxBidAdapter', () => {
453
509
  _Image = window.Image;
454
510
  window.Image = class FakeImage {
455
511
  set src(value) {
456
- firedPixels.push(value)
512
+ firedPixels.push(value);
457
513
  }
458
- }
514
+ };
459
515
  });
460
516
 
461
517
  beforeEach(() => {
@@ -479,24 +535,26 @@ describe('AmxBidAdapter', () => {
479
535
  adserverTargeting: {
480
536
  hb_pb: '1.23',
481
537
  hb_adid: 'ad-id',
482
- hb_bidder: 'example'
483
- }
538
+ hb_bidder: 'example',
539
+ },
484
540
  });
485
- expect(firedPixels.length).to.equal(1)
486
- expect(firedPixels[0]).to.match(/\/hbx\/g_pbst/)
541
+ expect(firedPixels.length).to.equal(1);
542
+ expect(firedPixels[0]).to.match(/\/hbx\/g_pbst/);
487
543
  try {
488
544
  const parsed = new URL(firedPixels[0]);
489
545
  const nestedData = parsed.searchParams.get('c2');
490
- expect(nestedData).to.equal(utils.formatQS({
491
- hb_pb: '1.23',
492
- hb_adid: 'ad-id',
493
- hb_bidder: 'example'
494
- }));
546
+ expect(nestedData).to.equal(
547
+ utils.formatQS({
548
+ hb_pb: '1.23',
549
+ hb_adid: 'ad-id',
550
+ hb_bidder: 'example',
551
+ })
552
+ );
495
553
  } catch (e) {
496
554
  // unsupported browser; try testing for string
497
555
  const pixel = firedPixels[0];
498
- expect(pixel).to.have.string(encodeURIComponent('hb_pb=1.23'))
499
- expect(pixel).to.have.string(encodeURIComponent('hb_adid=ad-id'))
556
+ expect(pixel).to.have.string(encodeURIComponent('hb_pb=1.23'));
557
+ expect(pixel).to.have.string(encodeURIComponent('hb_adid=ad-id'));
500
558
  }
501
559
  });
502
560
 
@@ -506,10 +564,10 @@ describe('AmxBidAdapter', () => {
506
564
  bidId: 'test-bid-id',
507
565
  adUnitCode: 'div-gpt-ad',
508
566
  timeout: 300,
509
- auctionId: utils.getUniqueIdentifierStr()
567
+ auctionId: utils.getUniqueIdentifierStr(),
510
568
  });
511
- expect(firedPixels.length).to.equal(1)
512
- expect(firedPixels[0]).to.match(/\/hbx\/g_pbto/)
569
+ expect(firedPixels.length).to.equal(1);
570
+ expect(firedPixels[0]).to.match(/\/hbx\/g_pbto/);
513
571
  });
514
572
 
515
573
  it('will log an event for prebid win', () => {
@@ -522,19 +580,19 @@ describe('AmxBidAdapter', () => {
522
580
  cpm: 1.34,
523
581
  adUnitCode: 'div-gpt-ad',
524
582
  timeout: 300,
525
- auctionId: utils.getUniqueIdentifierStr()
583
+ auctionId: utils.getUniqueIdentifierStr(),
526
584
  });
527
- expect(firedPixels.length).to.equal(1)
528
- expect(firedPixels[0]).to.match(/\/hbx\/g_pbwin/)
585
+ expect(firedPixels.length).to.equal(1);
586
+ expect(firedPixels[0]).to.match(/\/hbx\/g_pbwin/);
529
587
 
530
588
  const pixel = firedPixels[0];
531
589
  try {
532
590
  const url = new URL(pixel);
533
- expect(url.searchParams.get('C')).to.equal('1')
534
- expect(url.searchParams.get('np')).to.equal('1.34')
591
+ expect(url.searchParams.get('C')).to.equal('1');
592
+ expect(url.searchParams.get('np')).to.equal('1.34');
535
593
  } catch (e) {
536
- expect(pixel).to.have.string('C=1')
537
- expect(pixel).to.have.string('np=1.34')
594
+ expect(pixel).to.have.string('C=1');
595
+ expect(pixel).to.have.string('np=1.34');
538
596
  }
539
597
  });
540
598
  });