prebid.js 9.7.0 → 9.9.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 (255) hide show
  1. package/.github/codeql/codeql-config.yml +3 -0
  2. package/.github/codeql/queries/deviceMemory.ql +14 -0
  3. package/.github/codeql/queries/hardwareConcurrency.ql +14 -0
  4. package/.github/codeql/queries/prebid.qll +36 -0
  5. package/.github/codeql/queries/qlpack.yml +8 -0
  6. package/.github/workflows/jscpd.yml +1 -1
  7. package/dist/33acrossAnalyticsAdapter.js +1 -1
  8. package/dist/33acrossBidAdapter.js +1 -1
  9. package/dist/33acrossIdSystem.js +1 -1
  10. package/dist/BTBidAdapter.js +1 -1
  11. package/dist/adagioAnalyticsAdapter.js +1 -1
  12. package/dist/adagioBidAdapter.js +1 -1
  13. package/dist/adagioUtils.js +1 -1
  14. package/dist/addefendBidAdapter.js +1 -1
  15. package/dist/adgenerationBidAdapter.js +1 -1
  16. package/dist/adlooxRtdProvider.js +1 -1
  17. package/dist/admixerBidAdapter.js +1 -1
  18. package/dist/adqueryBidAdapter.js +1 -1
  19. package/dist/adrelevantisBidAdapter.js +1 -1
  20. package/dist/adstirBidAdapter.js +1 -1
  21. package/dist/adtrgtmeBidAdapter.js +1 -1
  22. package/dist/adxcgAnalyticsAdapter.js +1 -1
  23. package/dist/adxcgBidAdapter.js +1 -1
  24. package/dist/adyoulikeBidAdapter.js +1 -1
  25. package/dist/agmaAnalyticsAdapter.js +1 -1
  26. package/dist/ajaBidAdapter.js +1 -1
  27. package/dist/amxBidAdapter.js +1 -1
  28. package/dist/amxIdSystem.js +1 -1
  29. package/dist/appierAnalyticsAdapter.js +1 -1
  30. package/dist/appnexusBidAdapter.js +1 -1
  31. package/dist/asoBidAdapter.js +1 -1
  32. package/dist/axonixBidAdapter.js +1 -1
  33. package/dist/bidglassBidAdapter.js +1 -1
  34. package/dist/big-richmediaBidAdapter.js +1 -1
  35. package/dist/bridBidAdapter.js +1 -1
  36. package/dist/bridgewellBidAdapter.js +1 -1
  37. package/dist/brightMountainMediaBidAdapter.js +1 -1
  38. package/dist/carodaBidAdapter.js +1 -1
  39. package/dist/ccxBidAdapter.js +1 -1
  40. package/dist/chtnwBidAdapter.js +1 -1
  41. package/dist/chunk-core.js +1 -1
  42. package/dist/concertBidAdapter.js +1 -1
  43. package/dist/connectadBidAdapter.js +1 -1
  44. package/dist/consumableBidAdapter.js +1 -1
  45. package/dist/contxtfulRtdProvider.js +1 -1
  46. package/dist/conversantAnalyticsAdapter.js +1 -1
  47. package/dist/conversantBidAdapter.js +1 -1
  48. package/dist/craftBidAdapter.js +1 -1
  49. package/dist/criteoBidAdapter.js +1 -1
  50. package/dist/cwireBidAdapter.js +1 -1
  51. package/dist/dailymotionBidAdapter.js +1 -1
  52. package/dist/dependencies.json +19 -4
  53. package/dist/discoveryBidAdapter.js +1 -1
  54. package/dist/docereeAdManagerBidAdapter.js +1 -1
  55. package/dist/dspxBidAdapter.js +1 -1
  56. package/dist/dxkultureBidAdapter.js +1 -1
  57. package/dist/eclickadsBidAdapter.js +1 -0
  58. package/dist/eightPodAnalyticsAdapter.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/gmosspBidAdapter.js +1 -1
  66. package/dist/goldbachBidAdapter.js +1 -1
  67. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  68. package/dist/greenbidsRtdProvider.js +1 -1
  69. package/dist/gridBidAdapter.js +1 -1
  70. package/dist/gumgumBidAdapter.js +1 -1
  71. package/dist/h12mediaBidAdapter.js +1 -1
  72. package/dist/hypelabBidAdapter.js +1 -1
  73. package/dist/id5AnalyticsAdapter.js +1 -1
  74. package/dist/id5IdSystem.js +1 -1
  75. package/dist/imdsBidAdapter.js +1 -1
  76. package/dist/improvedigitalBidAdapter.js +1 -1
  77. package/dist/insticatorBidAdapter.js +1 -1
  78. package/dist/intentIqAnalyticsAdapter.js +1 -1
  79. package/dist/ixBidAdapter.js +1 -1
  80. package/dist/jixieBidAdapter.js +1 -1
  81. package/dist/justpremiumBidAdapter.js +1 -1
  82. package/dist/kargoBidAdapter.js +1 -1
  83. package/dist/kimberliteBidAdapter.js +1 -1
  84. package/dist/konduitAnalyticsAdapter.js +1 -1
  85. package/dist/kueezBidAdapter.js +1 -1
  86. package/dist/lassoBidAdapter.js +1 -1
  87. package/dist/lifestreetBidAdapter.js +1 -1
  88. package/dist/limelightDigitalBidAdapter.js +1 -1
  89. package/dist/liveIntentIdSystem.js +1 -1
  90. package/dist/logicadBidAdapter.js +1 -1
  91. package/dist/loglyliftBidAdapter.js +1 -1
  92. package/dist/luceadBidAdapter.js +1 -1
  93. package/dist/mabidderBidAdapter.js +1 -1
  94. package/dist/magniteAnalyticsAdapter.js +1 -1
  95. package/dist/malltvAnalyticsAdapter.js +1 -1
  96. package/dist/marsmediaBidAdapter.js +1 -1
  97. package/dist/mediafuseBidAdapter.js +1 -1
  98. package/dist/mediagoBidAdapter.js +1 -1
  99. package/dist/medianetAnalyticsAdapter.js +1 -1
  100. package/dist/medianetBidAdapter.js +1 -1
  101. package/dist/mediasquareBidAdapter.js +1 -1
  102. package/dist/mgidBidAdapter.js +1 -1
  103. package/dist/mgidUtils.js +1 -0
  104. package/dist/mgidXBidAdapter.js +1 -1
  105. package/dist/missenaBidAdapter.js +1 -1
  106. package/dist/mobianRtdProvider.js +1 -1
  107. package/dist/naveggIdSystem.js +1 -1
  108. package/dist/navigatorData.js +1 -0
  109. package/dist/nexx360BidAdapter.js +1 -1
  110. package/dist/nobidAnalyticsAdapter.js +1 -1
  111. package/dist/nobidBidAdapter.js +1 -1
  112. package/dist/not-for-prod/prebid.js +174 -169
  113. package/dist/oguryBidAdapter.js +1 -1
  114. package/dist/omsBidAdapter.js +1 -1
  115. package/dist/onetagBidAdapter.js +1 -1
  116. package/dist/ooloAnalyticsAdapter.js +1 -1
  117. package/dist/openxBidAdapter.js +1 -1
  118. package/dist/optidigitalBidAdapter.js +1 -1
  119. package/dist/orbidderBidAdapter.js +1 -1
  120. package/dist/outbrainBidAdapter.js +1 -1
  121. package/dist/pixfutureBidAdapter.js +1 -1
  122. package/dist/pstudioBidAdapter.js +1 -1
  123. package/dist/publinkIdSystem.js +1 -1
  124. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  125. package/dist/pubmaticBidAdapter.js +1 -1
  126. package/dist/pubriseBidAdapter.js +1 -0
  127. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  128. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  129. package/dist/pubxaiRtdProvider.js +1 -1
  130. package/dist/pxyzBidAdapter.js +1 -1
  131. package/dist/quantcastBidAdapter.js +1 -1
  132. package/dist/readpeakBidAdapter.js +1 -1
  133. package/dist/redtramBidAdapter.js +1 -1
  134. package/dist/relaidoBidAdapter.js +1 -1
  135. package/dist/retailspotBidAdapter.js +1 -1
  136. package/dist/rhythmoneBidAdapter.js +1 -1
  137. package/dist/richaudienceBidAdapter.js +1 -1
  138. package/dist/riseUtils.js +1 -1
  139. package/dist/rubiconBidAdapter.js +1 -1
  140. package/dist/seedingAllianceBidAdapter.js +1 -1
  141. package/dist/seedtagBidAdapter.js +1 -1
  142. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  143. package/dist/sharethroughBidAdapter.js +1 -1
  144. package/dist/smaatoBidAdapter.js +1 -1
  145. package/dist/smartadserverBidAdapter.js +1 -1
  146. package/dist/smarthubBidAdapter.js +1 -1
  147. package/dist/smartxBidAdapter.js +1 -1
  148. package/dist/smilewantedBidAdapter.js +1 -1
  149. package/dist/snigelBidAdapter.js +1 -1
  150. package/dist/sonobiBidAdapter.js +1 -1
  151. package/dist/sovrnBidAdapter.js +1 -1
  152. package/dist/sspBCBidAdapter.js +1 -1
  153. package/dist/stvBidAdapter.js +1 -1
  154. package/dist/sublimeBidAdapter.js +1 -1
  155. package/dist/taboolaBidAdapter.js +1 -1
  156. package/dist/tappxBidAdapter.js +1 -1
  157. package/dist/targetVideoAdServerVideo.js +1 -0
  158. package/dist/targetVideoBidAdapter.js +1 -1
  159. package/dist/teadsBidAdapter.js +1 -1
  160. package/dist/teqblazeUtils.js +1 -1
  161. package/dist/terceptAnalyticsAdapter.js +1 -1
  162. package/dist/themoneytizerBidAdapter.js +1 -1
  163. package/dist/trionBidAdapter.js +1 -1
  164. package/dist/tripleliftBidAdapter.js +1 -1
  165. package/dist/ttdBidAdapter.js +1 -1
  166. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  167. package/dist/uid2IdSystem.js +1 -1
  168. package/dist/underdogmediaBidAdapter.js +1 -1
  169. package/dist/undertoneBidAdapter.js +1 -1
  170. package/dist/unrulyBidAdapter.js +1 -1
  171. package/dist/userId.js +1 -1
  172. package/dist/vidazooUtils.js +1 -1
  173. package/dist/videobyteBidAdapter.js +1 -1
  174. package/dist/visxBidAdapter.js +1 -1
  175. package/dist/vuukleBidAdapter.js +1 -1
  176. package/dist/widespaceBidAdapter.js +1 -1
  177. package/dist/winrBidAdapter.js +1 -1
  178. package/dist/yahooAdsBidAdapter.js +1 -1
  179. package/dist/yieldmoBidAdapter.js +1 -1
  180. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  181. package/libraries/mgidUtils/mgidUtils.js +73 -0
  182. package/{src/fpd/navigator.js → libraries/navigatorData/navigatorData.js} +1 -1
  183. package/libraries/riseUtils/index.js +1 -1
  184. package/libraries/teqblazeUtils/bidderUtils.js +1 -1
  185. package/modules/admixerBidAdapter.js +12 -5
  186. package/modules/appnexusBidAdapter.js +1 -1
  187. package/modules/ccxBidAdapter.js +6 -2
  188. package/modules/contxtfulRtdProvider.js +15 -12
  189. package/modules/cwireBidAdapter.js +13 -9
  190. package/modules/cwireBidAdapter.md +29 -10
  191. package/modules/dailymotionBidAdapter.js +1 -1
  192. package/modules/dailymotionBidAdapter.md +11 -7
  193. package/modules/discoveryBidAdapter.js +1 -3
  194. package/modules/docereeAdManagerBidAdapter.js +14 -8
  195. package/modules/eclickadsBidAdapter.js +80 -0
  196. package/modules/eclickadsBidAdapter.md +55 -0
  197. package/modules/eightPodAnalyticsAdapter.js +13 -1
  198. package/modules/gumgumBidAdapter.js +6 -2
  199. package/modules/ixBidAdapter.js +0 -1
  200. package/modules/limelightDigitalBidAdapter.js +1 -1
  201. package/modules/mediagoBidAdapter.js +2 -4
  202. package/modules/mgidBidAdapter.js +30 -109
  203. package/modules/mgidXBidAdapter.js +2 -66
  204. package/modules/mobianRtdProvider.js +12 -8
  205. package/modules/naveggIdSystem.js +62 -58
  206. package/modules/naveggIdSystem.md +8 -0
  207. package/modules/oguryBidAdapter.js +5 -2
  208. package/modules/omsBidAdapter.js +1 -1
  209. package/modules/openxBidAdapter.js +1 -6
  210. package/modules/pstudioBidAdapter.js +5 -8
  211. package/modules/pstudioBidAdapter.md +6 -4
  212. package/modules/pubriseBidAdapter.js +19 -0
  213. package/modules/pubriseBidAdapter.md +79 -0
  214. package/modules/pubxaiAnalyticsAdapter.js +9 -4
  215. package/modules/pubxaiRtdProvider.js +38 -18
  216. package/modules/pubxaiRtdProvider.md +2 -2
  217. package/modules/redtramBidAdapter.js +2 -6
  218. package/modules/richaudienceBidAdapter.js +8 -1
  219. package/modules/rubiconBidAdapter.js +3 -3
  220. package/modules/smarthubBidAdapter.js +2 -0
  221. package/modules/targetVideoAdServerVideo.js +96 -0
  222. package/modules/targetVideoAdServerVideo.md +26 -0
  223. package/modules/teadsBidAdapter.js +4 -3
  224. package/modules/undertoneBidAdapter.js +1 -19
  225. package/modules/userId/index.js +1 -1
  226. package/package.json +1 -1
  227. package/src/adRendering.js +3 -0
  228. package/src/adapterManager.js +4 -0
  229. package/src/utils/focusTimeout.js +17 -6
  230. package/src/utils/ttlCollection.js +1 -1
  231. package/src/utils.js +28 -0
  232. package/test/spec/modules/admixerBidAdapter_spec.js +2 -2
  233. package/test/spec/modules/ccxBidAdapter_spec.js +81 -0
  234. package/test/spec/modules/contxtfulRtdProvider_spec.js +19 -19
  235. package/test/spec/modules/dailymotionBidAdapter_spec.js +12 -12
  236. package/test/spec/modules/discoveryBidAdapter_spec.js +1 -47
  237. package/test/spec/modules/docereeAdManagerBidAdapter_spec.js +87 -9
  238. package/test/spec/modules/eclickadsBidAdapter_spec.js +214 -0
  239. package/test/spec/modules/ixBidAdapter_spec.js +8 -1
  240. package/test/spec/modules/mobianRtdProvider_spec.js +32 -15
  241. package/test/spec/modules/naveggIdSystem_spec.js +141 -31
  242. package/test/spec/modules/oguryBidAdapter_spec.js +50 -4
  243. package/test/spec/modules/openxBidAdapter_spec.js +16 -49
  244. package/test/spec/modules/pstudioBidAdapter_spec.js +5 -5
  245. package/test/spec/modules/pubriseBidAdapter_spec.js +514 -0
  246. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +9 -4
  247. package/test/spec/modules/pubxaiRtdProvider_spec.js +37 -5
  248. package/test/spec/modules/richaudienceBidAdapter_spec.js +62 -0
  249. package/test/spec/modules/rubiconBidAdapter_spec.js +10 -0
  250. package/test/spec/modules/targetVideoAdServerVideo_spec.js +179 -0
  251. package/test/spec/modules/trafficgateBidAdapter_spec.js +1 -1
  252. package/test/spec/ortbConverter/userId_spec.js +23 -2
  253. package/test/spec/unit/adRendering_spec.js +27 -1
  254. package/test/spec/unit/core/adapterManager_spec.js +10 -0
  255. package/test/spec/unit/utils/focusTimeout_spec.js +33 -6
@@ -12,7 +12,9 @@ describe('Mobian RTD Submodule', function () {
12
12
  ortb2Fragments: {
13
13
  global: {
14
14
  site: {
15
- ext: {}
15
+ ext: {
16
+ data: {}
17
+ }
16
18
  }
17
19
  }
18
20
  }
@@ -23,7 +25,7 @@ describe('Mobian RTD Submodule', function () {
23
25
  ajaxStub.restore();
24
26
  });
25
27
 
26
- it('should return risk level when server responds with garm_risk', function () {
28
+ it('should set key-value pairs when server responds with garm_risk', function () {
27
29
  ajaxStub = sinon.stub(ajax, 'ajaxBuilder').returns(function(url, callbacks) {
28
30
  callbacks.success(JSON.stringify({
29
31
  garm_risk: 'low',
@@ -32,14 +34,19 @@ describe('Mobian RTD Submodule', function () {
32
34
  }));
33
35
  });
34
36
 
35
- return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
36
- expect(risk).to.deep.equal({
37
+ return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((result) => {
38
+ expect(result).to.deep.equal({
37
39
  risk: 'low',
38
40
  contentCategories: [],
39
41
  sentiment: 'positive',
40
42
  emotions: ['joy']
41
43
  });
42
- expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
44
+ expect(bidReqConfig.ortb2Fragments.global.site.ext.data).to.deep.include({
45
+ mobianRisk: 'low',
46
+ mobianContentCategories: [],
47
+ mobianSentiment: 'positive',
48
+ mobianEmotions: ['joy']
49
+ });
43
50
  });
44
51
  });
45
52
 
@@ -55,14 +62,19 @@ describe('Mobian RTD Submodule', function () {
55
62
  }));
56
63
  });
57
64
 
58
- return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
59
- expect(risk).to.deep.equal({
65
+ return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((result) => {
66
+ expect(result).to.deep.equal({
60
67
  risk: 'medium',
61
68
  contentCategories: ['arms', 'crime'],
62
69
  sentiment: 'negative',
63
70
  emotions: ['anger', 'fear']
64
71
  });
65
- expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
72
+ expect(bidReqConfig.ortb2Fragments.global.site.ext.data).to.deep.include({
73
+ mobianRisk: 'medium',
74
+ mobianContentCategories: ['arms', 'crime'],
75
+ mobianSentiment: 'negative',
76
+ mobianEmotions: ['anger', 'fear']
77
+ });
66
78
  });
67
79
  });
68
80
 
@@ -73,14 +85,19 @@ describe('Mobian RTD Submodule', function () {
73
85
  }));
74
86
  });
75
87
 
76
- return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
77
- expect(risk).to.deep.equal({
88
+ return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((result) => {
89
+ expect(result).to.deep.equal({
78
90
  risk: 'unknown',
79
91
  contentCategories: [],
80
92
  sentiment: 'neutral',
81
93
  emotions: []
82
94
  });
83
- expect(bidReqConfig.ortb2Fragments.global.site.ext.data.mobian).to.deep.equal(risk);
95
+ expect(bidReqConfig.ortb2Fragments.global.site.ext.data).to.deep.include({
96
+ mobianRisk: 'unknown',
97
+ mobianContentCategories: [],
98
+ mobianSentiment: 'neutral',
99
+ mobianEmotions: []
100
+ });
84
101
  });
85
102
  });
86
103
 
@@ -89,8 +106,8 @@ describe('Mobian RTD Submodule', function () {
89
106
  callbacks.success('unexpected output not even of the right type');
90
107
  });
91
108
  const originalConfig = JSON.parse(JSON.stringify(bidReqConfig));
92
- return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
93
- expect(risk).to.deep.equal({});
109
+ return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((result) => {
110
+ expect(result).to.deep.equal({});
94
111
  // Check that bidReqConfig hasn't been modified
95
112
  expect(bidReqConfig).to.deep.equal(originalConfig);
96
113
  });
@@ -101,8 +118,8 @@ describe('Mobian RTD Submodule', function () {
101
118
  callbacks.error();
102
119
  });
103
120
 
104
- return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((risk) => {
105
- expect(risk).to.deep.equal({});
121
+ return mobianBrandSafetySubmodule.getBidRequestData(bidReqConfig, {}, {}).then((result) => {
122
+ expect(result).to.deep.equal({});
106
123
  });
107
124
  });
108
125
  });
@@ -1,45 +1,155 @@
1
- import { naveggIdSubmodule, storage } from 'modules/naveggIdSystem.js';
1
+ import { naveggIdSubmodule, storage, getIdFromAPI } from 'modules/naveggIdSystem.js';
2
+ import { server } from 'test/mocks/xhr.js';
3
+ import * as ajaxLib from 'src/ajax.js';
2
4
 
3
- describe('naveggId', function () {
4
- let sandbox;
5
- beforeEach(() => {
6
- sandbox = sinon.sandbox.create();
7
- sandbox.stub(storage, 'getDataFromLocalStorage');
5
+ const NAVEGGID_CONFIG_COOKIE_HTML5 = {
6
+ storage: {
7
+ name: 'nvggid',
8
+ type: 'cookie&html5',
9
+ expires: 8
10
+ }
11
+ }
12
+
13
+ const MOCK_RESPONSE = {
14
+ nvggid: 'test_nvggid'
15
+ }
16
+
17
+ const MOCK_RESPONSE_NULL = {
18
+ nvggid: null
19
+ }
20
+
21
+ function mockResponse(responseText, isSuccess = true) {
22
+ return function(url, callbacks) {
23
+ if (isSuccess) {
24
+ callbacks.success(responseText)
25
+ } else {
26
+ callbacks.error(new Error('Mock Error'))
27
+ }
28
+ }
29
+ }
30
+
31
+ function deleteAllCookies() {
32
+ document.cookie.split(';').forEach(cookie => {
33
+ const eqPos = cookie.indexOf('=');
34
+ const name = eqPos > -1 ? cookie.substring(0, eqPos) : cookie;
35
+ document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT';
36
+ });
37
+ }
38
+
39
+ function setLocalStorage() {
40
+ storage.setDataInLocalStorage('nvggid', 'localstorage_value');
41
+ }
42
+
43
+ describe('getId', function () {
44
+ let ajaxStub, ajaxBuilderStub;
45
+
46
+ beforeEach(function() {
47
+ ajaxStub = sinon.stub();
48
+ ajaxBuilderStub = sinon.stub(ajaxLib, 'ajaxBuilder').returns(ajaxStub);
49
+ });
50
+
51
+ afterEach(function() {
52
+ ajaxBuilderStub.restore();
53
+ deleteAllCookies();
54
+ storage.removeDataFromLocalStorage('nvggid');
55
+ });
56
+
57
+ it('should get the value from the existing localstorage', function() {
58
+ setLocalStorage();
59
+
60
+ const callback = sinon.spy();
61
+ const apiCallback = naveggIdSubmodule.getId(NAVEGGID_CONFIG_COOKIE_HTML5).callback;
62
+
63
+ ajaxStub.callsFake((url, successCallbacks, errorCallback, options) => {
64
+ if (successCallbacks && typeof successCallbacks === 'function') {
65
+ successCallbacks(JSON.stringify(MOCK_RESPONSE_NULL));
66
+ }
67
+ });
68
+ apiCallback(callback)
69
+
70
+ expect(callback.calledOnce).to.be.true;
71
+ expect(callback.calledWith('localstorage_value')).to.be.true;
8
72
  });
9
- afterEach(() => {
10
- sandbox.restore();
73
+
74
+ it('should get the value from a nid cookie', function() {
75
+ storage.setCookie('nid', 'old_nid_cookie', storage.expires)
76
+
77
+ const callback = sinon.spy();
78
+ const apiCallback = naveggIdSubmodule.getId(NAVEGGID_CONFIG_COOKIE_HTML5).callback;
79
+
80
+ ajaxStub.callsFake((url, successCallbacks, errorCallback, options) => {
81
+ if (successCallbacks && typeof successCallbacks === 'function') {
82
+ successCallbacks(JSON.stringify(MOCK_RESPONSE_NULL));
83
+ }
84
+ });
85
+ apiCallback(callback)
86
+
87
+ expect(callback.calledOnce).to.be.true;
88
+ expect(callback.calledWith('old_nid_cookie')).to.be.true;
11
89
  });
12
90
 
13
- it('should NOT find navegg id', function () {
14
- let id = naveggIdSubmodule.getId();
91
+ it('should get the value from a nav cookie', function() {
92
+ storage.setCookie('navId', 'old_nav_cookie', storage.expires)
93
+
94
+ const callback = sinon.spy();
95
+ const apiCallback = naveggIdSubmodule.getId(NAVEGGID_CONFIG_COOKIE_HTML5).callback;
15
96
 
16
- expect(id).to.be.undefined;
97
+ ajaxStub.callsFake((url, successCallbacks, errorCallback, options) => {
98
+ if (successCallbacks && typeof successCallbacks === 'function') {
99
+ successCallbacks(JSON.stringify(MOCK_RESPONSE_NULL));
100
+ }
101
+ });
102
+ apiCallback(callback)
103
+
104
+ expect(callback.calledOnce).to.be.true;
105
+ expect(callback.calledWith('old_nav_cookie')).to.be.true;
17
106
  });
18
107
 
19
- it('getId() should return "test-nid" id from cookie OLD_NAVEGG_ID', function() {
20
- sinon.stub(storage, 'getCookie').withArgs('nid').returns('test-nid');
21
- let id = naveggIdSubmodule.getId();
22
- expect(id).to.be.deep.equal({id: 'test-nid'})
23
- })
108
+ it('should get the value from an old nvg cookie', function() {
109
+ storage.setCookie('nvgid', 'old_nvg_cookie', storage.expires)
110
+
111
+ const callback = sinon.spy();
112
+ const apiCallback = naveggIdSubmodule.getId(NAVEGGID_CONFIG_COOKIE_HTML5).callback;
113
+
114
+ ajaxStub.callsFake((url, successCallbacks, errorCallback, options) => {
115
+ if (successCallbacks && typeof successCallbacks === 'function') {
116
+ successCallbacks(JSON.stringify(MOCK_RESPONSE_NULL));
117
+ }
118
+ });
119
+ apiCallback(callback)
24
120
 
25
- it('getId() should return "test-nvggid" id from local storage NAVEGG_ID', function() {
26
- storage.getDataFromLocalStorage.callsFake(() => 'test-ninvggidd')
121
+ expect(callback.calledOnce).to.be.true;
122
+ expect(callback.calledWith('old_nvg_cookie')).to.be.true;
123
+ });
27
124
 
28
- let id = naveggIdSubmodule.getId();
29
- expect(id).to.be.deep.equal({id: 'test-ninvggidd'})
30
- })
125
+ it('should return correct value from API response', function(done) {
126
+ const callback = sinon.spy();
127
+ const apiCallback = naveggIdSubmodule.getId(NAVEGGID_CONFIG_COOKIE_HTML5).callback;
31
128
 
32
- it('getId() should return "test-nvggid" id from local storage NAV0', function() {
33
- storage.getDataFromLocalStorage.callsFake(() => 'nvgid-nav0')
129
+ ajaxStub.callsFake((url, successCallbacks, errorCallback, options) => {
130
+ if (successCallbacks && typeof successCallbacks === 'function') {
131
+ successCallbacks(JSON.stringify(MOCK_RESPONSE));
132
+ }
133
+ });
134
+ apiCallback(callback)
34
135
 
35
- let id = naveggIdSubmodule.getId();
36
- expect(id).to.be.deep.equal({id: 'nvgid-nav0'})
37
- })
136
+ expect(callback.calledOnce).to.be.true;
137
+ expect(callback.calledWith('test_nvggid')).to.be.true;
138
+ done();
139
+ });
38
140
 
39
- it('getId() should return "test-nvggid" id from local storage NVG0', function() {
40
- storage.getDataFromLocalStorage.callsFake(() => 'nvgid-nvg0')
141
+ it('should return no value from API response', function(done) {
142
+ const callback = sinon.spy();
143
+ const apiCallback = naveggIdSubmodule.getId(NAVEGGID_CONFIG_COOKIE_HTML5).callback;
41
144
 
42
- let id = naveggIdSubmodule.getId();
43
- expect(id).to.be.deep.equal({id: 'nvgid-nvg0'})
44
- })
145
+ ajaxStub.callsFake((url, successCallbacks, errorCallback, options) => {
146
+ if (successCallbacks && typeof successCallbacks === 'function') {
147
+ successCallbacks(JSON.stringify(MOCK_RESPONSE_NULL));
148
+ }
149
+ });
150
+ apiCallback(callback)
151
+ expect(callback.calledOnce).to.be.true;
152
+ expect(callback.calledWith(undefined)).to.be.true;
153
+ done();
154
+ });
45
155
  });
@@ -13,6 +13,11 @@ describe('OguryBidAdapter', function () {
13
13
  bidRequests = [
14
14
  {
15
15
  adUnitCode: 'adUnitCode',
16
+ ortb2Imp: {
17
+ ext: {
18
+ gpid: 'gpid'
19
+ }
20
+ },
16
21
  auctionId: 'auctionId',
17
22
  bidId: 'bidId',
18
23
  bidder: 'ogury',
@@ -394,6 +399,7 @@ describe('OguryBidAdapter', function () {
394
399
  },
395
400
  ext: {
396
401
  ...bidRequests[0].params,
402
+ gpid: bidRequests[0].ortb2Imp.ext.gpid,
397
403
  timeSpentOnPage: stubbedCurrentTime
398
404
  }
399
405
  }, {
@@ -441,7 +447,7 @@ describe('OguryBidAdapter', function () {
441
447
  },
442
448
  ext: {
443
449
  prebidversion: '$prebid.version$',
444
- adapterversion: '1.6.0'
450
+ adapterversion: '1.6.1'
445
451
  },
446
452
  device: {
447
453
  w: stubbedWidth,
@@ -824,7 +830,47 @@ describe('OguryBidAdapter', function () {
824
830
  const request = spec.buildRequests(validBidRequests, bidderRequest);
825
831
  expect(request.data).to.deep.equal(expectedRequestWithUnsupportedFloorCurrency);
826
832
  });
827
- });
833
+
834
+ it('should not add gpid if ortb2 undefined', () => {
835
+ const expectedRequestWithUndefinedGpid = utils.deepClone(expectedRequestObject)
836
+
837
+ delete expectedRequestWithUndefinedGpid.imp[0].ext.gpid;
838
+ delete expectedRequestWithUndefinedGpid.imp[1].ext.gpid;
839
+
840
+ const validBidRequests = utils.deepClone(bidRequests);
841
+ delete validBidRequests[0].ortb2Imp.ext.gpid;
842
+
843
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
844
+ expect(request.data).to.deep.equal(expectedRequestWithUndefinedGpid);
845
+ });
846
+
847
+ it('should not add gpid if gpid undefined', () => {
848
+ const expectedRequestWithUndefinedGpid = utils.deepClone(expectedRequestObject)
849
+
850
+ delete expectedRequestWithUndefinedGpid.imp[0].ext.gpid;
851
+ delete expectedRequestWithUndefinedGpid.imp[1].ext.gpid;
852
+
853
+ const validBidRequests = utils.deepClone(bidRequests);
854
+ validBidRequests[0] = {
855
+ ...validBidRequests[0],
856
+ ortb2Imp: {
857
+ ext: {}
858
+ }
859
+ };
860
+
861
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
862
+ expect(request.data).to.deep.equal(expectedRequestWithUndefinedGpid);
863
+ });
864
+
865
+ it('should send gpid in bid request', function() {
866
+ const validBidRequests = utils.deepClone(bidRequests)
867
+
868
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
869
+ expect(request.data).to.deep.equal(expectedRequestObject);
870
+ expect(request.data.imp[0].ext.gpid).to.be.a('string');
871
+ expect(request.data.imp[1].ext.gpid).to.be.undefined
872
+ })
873
+ })
828
874
 
829
875
  describe('interpretResponse', function () {
830
876
  let openRtbBidResponse = {
@@ -891,7 +937,7 @@ describe('OguryBidAdapter', function () {
891
937
  advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[0].adomain
892
938
  },
893
939
  nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl,
894
- adapterVersion: '1.6.0',
940
+ adapterVersion: '1.6.1',
895
941
  prebidVersion: '$prebid.version$'
896
942
  }, {
897
943
  requestId: openRtbBidResponse.body.seatbid[0].bid[1].impid,
@@ -908,7 +954,7 @@ describe('OguryBidAdapter', function () {
908
954
  advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[1].adomain
909
955
  },
910
956
  nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl,
911
- adapterVersion: '1.6.0',
957
+ adapterVersion: '1.6.1',
912
958
  prebidVersion: '$prebid.version$'
913
959
  }]
914
960
 
@@ -1025,7 +1025,7 @@ describe('OpenxRtbAdapter', function () {
1025
1025
  // enrich bid request with userId key/value
1026
1026
 
1027
1027
  const request = spec.buildRequests(bidRequestsWithUserId, mockBidderRequest);
1028
- expect(request[0].data.user.ext.eids).to.equal(userIdAsEids);
1028
+ expect(request[0].data.user.ext.eids).to.eql(userIdAsEids);
1029
1029
  });
1030
1030
 
1031
1031
  it(`when no user ids are available, it should not send any extended ids`, function () {
@@ -1109,7 +1109,7 @@ describe('OpenxRtbAdapter', function () {
1109
1109
  let bid;
1110
1110
 
1111
1111
  context('when there is an nbr response', function () {
1112
- let bids;
1112
+ let response;
1113
1113
  beforeEach(function () {
1114
1114
  bidRequestConfigs = [{
1115
1115
  bidder: 'openx',
@@ -1131,16 +1131,16 @@ describe('OpenxRtbAdapter', function () {
1131
1131
  bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
1132
1132
 
1133
1133
  bidResponse = {nbr: 0}; // Unknown error
1134
- bids = spec.interpretResponse({body: bidResponse}, bidRequest);
1134
+ response = spec.interpretResponse({body: bidResponse}, bidRequest);
1135
1135
  });
1136
1136
 
1137
1137
  it('should not return any bids', function () {
1138
- expect(bids.length).to.equal(0);
1138
+ expect(response.bids.length).to.equal(0);
1139
1139
  });
1140
1140
  });
1141
1141
 
1142
1142
  context('when no seatbid in response', function () {
1143
- let bids;
1143
+ let response;
1144
1144
  beforeEach(function () {
1145
1145
  bidRequestConfigs = [{
1146
1146
  bidder: 'openx',
@@ -1162,16 +1162,16 @@ describe('OpenxRtbAdapter', function () {
1162
1162
  bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
1163
1163
 
1164
1164
  bidResponse = {ext: {}, id: 'test-bid-id'};
1165
- bids = spec.interpretResponse({body: bidResponse}, bidRequest);
1165
+ response = spec.interpretResponse({body: bidResponse}, bidRequest);
1166
1166
  });
1167
1167
 
1168
1168
  it('should not return any bids', function () {
1169
- expect(bids.length).to.equal(0);
1169
+ expect(response.bids.length).to.equal(0);
1170
1170
  });
1171
1171
  });
1172
1172
 
1173
1173
  context('when there is no response', function () {
1174
- let bids;
1174
+ let response;
1175
1175
  beforeEach(function () {
1176
1176
  bidRequestConfigs = [{
1177
1177
  bidder: 'openx',
@@ -1193,11 +1193,11 @@ describe('OpenxRtbAdapter', function () {
1193
1193
  bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
1194
1194
 
1195
1195
  bidResponse = ''; // Unknown error
1196
- bids = spec.interpretResponse({body: bidResponse}, bidRequest);
1196
+ response = spec.interpretResponse({body: bidResponse}, bidRequest);
1197
1197
  });
1198
1198
 
1199
1199
  it('should not return any bids', function () {
1200
- expect(bids.length).to.equal(0);
1200
+ expect(response.bids.length).to.equal(0);
1201
1201
  });
1202
1202
  });
1203
1203
 
@@ -1232,19 +1232,11 @@ describe('OpenxRtbAdapter', function () {
1232
1232
  ext: {
1233
1233
  dsp_id: '123',
1234
1234
  buyer_id: '456',
1235
- brand_id: '789',
1236
- paf: {
1237
- content_id: 'paf_content_id'
1238
- }
1235
+ brand_id: '789'
1239
1236
  }
1240
1237
  }]
1241
1238
  }],
1242
- cur: 'AUS',
1243
- ext: {
1244
- paf: {
1245
- transmission: {version: '12'}
1246
- }
1247
- }
1239
+ cur: 'AUS'
1248
1240
  };
1249
1241
 
1250
1242
  context('when there is a response, the common response properties', function () {
@@ -1253,7 +1245,7 @@ describe('OpenxRtbAdapter', function () {
1253
1245
  bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
1254
1246
  bidResponse = deepClone(SAMPLE_BID_RESPONSE);
1255
1247
 
1256
- bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
1248
+ bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];
1257
1249
  });
1258
1250
 
1259
1251
  it('should return a price', function () {
@@ -1308,33 +1300,8 @@ describe('OpenxRtbAdapter', function () {
1308
1300
  it('should return adomain', function () {
1309
1301
  expect(bid.meta.advertiserDomains).to.equal(bidResponse.seatbid[0].bid[0].adomain);
1310
1302
  });
1311
-
1312
- it('should return paf fields', function () {
1313
- const paf = {
1314
- transmission: {version: '12'},
1315
- content_id: 'paf_content_id'
1316
- }
1317
- expect(bid.meta.paf).to.deep.equal(paf);
1318
- });
1319
1303
  });
1320
1304
 
1321
- context('when there is more than one response', () => {
1322
- let bids;
1323
- beforeEach(function () {
1324
- bidRequestConfigs = deepClone(SAMPLE_BID_REQUESTS);
1325
- bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
1326
- bidResponse = deepClone(SAMPLE_BID_RESPONSE);
1327
- bidResponse.seatbid[0].bid.push(deepClone(bidResponse.seatbid[0].bid[0]));
1328
- bidResponse.seatbid[0].bid[1].ext.paf.content_id = 'second_paf'
1329
-
1330
- bids = spec.interpretResponse({body: bidResponse}, bidRequest);
1331
- });
1332
-
1333
- it('should not confuse paf content_id', () => {
1334
- expect(bids.map(b => b.meta.paf.content_id)).to.eql(['paf_content_id', 'second_paf']);
1335
- });
1336
- })
1337
-
1338
1305
  context('when the response is a banner', function() {
1339
1306
  beforeEach(function () {
1340
1307
  bidRequestConfigs = [{
@@ -1371,7 +1338,7 @@ describe('OpenxRtbAdapter', function () {
1371
1338
  cur: 'AUS'
1372
1339
  };
1373
1340
 
1374
- bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
1341
+ bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];
1375
1342
  });
1376
1343
 
1377
1344
  it('should return the proper mediaType', function () {
@@ -1420,14 +1387,14 @@ describe('OpenxRtbAdapter', function () {
1420
1387
  });
1421
1388
 
1422
1389
  it('should return the proper mediaType', function () {
1423
- bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
1390
+ bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];
1424
1391
  expect(bid.mediaType).to.equal(Object.keys(bidRequestConfigs[0].mediaTypes)[0]);
1425
1392
  });
1426
1393
 
1427
1394
  it('should return the proper mediaType', function () {
1428
1395
  const winUrl = 'https//my.win.url';
1429
1396
  bidResponse.seatbid[0].bid[0].nurl = winUrl
1430
- bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
1397
+ bid = spec.interpretResponse({body: bidResponse}, bidRequest).bids[0];
1431
1398
 
1432
1399
  expect(bid.vastUrl).to.equal(winUrl);
1433
1400
  });
@@ -18,7 +18,7 @@ describe('PStudioAdapter', function () {
18
18
  bidder: 'pstudio',
19
19
  params: {
20
20
  pubid: '258c2a8d-d2ad-4c31-a2a5-e63001186456',
21
- floorPrice: 1.15,
21
+ adtagid: 'aae1aabb-6699-4b5a-9c3f-9ed034b1932c',
22
22
  },
23
23
  adUnitCode: 'test-div-1',
24
24
  mediaTypes: {
@@ -38,7 +38,7 @@ describe('PStudioAdapter', function () {
38
38
  bidder: 'pstudio',
39
39
  params: {
40
40
  pubid: '258c2a8d-d2ad-4c31-a2a5-e63001186456',
41
- floorPrice: 1.15,
41
+ adtagid: '34833639-f17c-40bc-9c4b-222b1b7459c7',
42
42
  },
43
43
  adUnitCode: 'test-div-1',
44
44
  mediaTypes: {
@@ -197,7 +197,7 @@ describe('PStudioAdapter', function () {
197
197
  it('should return false when publisher id not found', function () {
198
198
  const localBid = deepClone(bannerBid);
199
199
  delete localBid.params.pubid;
200
- delete localBid.params.floorPrice;
200
+ delete localBid.params.adtagid;
201
201
 
202
202
  expect(spec.isBidRequestValid(localBid)).to.equal(false);
203
203
  });
@@ -232,7 +232,7 @@ describe('PStudioAdapter', function () {
232
232
 
233
233
  it('should properly map ids in request payload', function () {
234
234
  expect(bannerPayload.id).to.equal(bannerBid.bidId);
235
- expect(bannerPayload.adtagid).to.equal(bannerBid.adUnitCode);
235
+ expect(bannerPayload.adtagid).to.equal(bannerBid.params.adtagid);
236
236
  });
237
237
 
238
238
  it('should properly map banner mediaType in request payload', function () {
@@ -266,7 +266,7 @@ describe('PStudioAdapter', function () {
266
266
 
267
267
  it('should properly set required bidder params in request payload', function () {
268
268
  expect(bannerPayload.pubid).to.equal(bannerBid.params.pubid);
269
- expect(bannerPayload.floor_price).to.equal(bannerBid.params.floorPrice);
269
+ expect(bannerPayload.adtagid).to.equal(bannerBid.params.adtagid);
270
270
  });
271
271
 
272
272
  it('should omit optional bidder params or first-party data from bid request if they are not provided', function () {