prebid.js 7.44.0 → 7.45.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 (254) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/acuityAdsBidAdapter.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adtrgtmeBidAdapter.js +1 -1
  9. package/dist/adxcgBidAdapter.js +1 -1
  10. package/dist/adyoulikeBidAdapter.js +1 -1
  11. package/dist/ajaBidAdapter.js +1 -1
  12. package/dist/amxBidAdapter.js +1 -1
  13. package/dist/amxIdSystem.js +1 -1
  14. package/dist/appierAnalyticsAdapter.js +1 -1
  15. package/dist/appnexusBidAdapter.js +1 -1
  16. package/dist/appushBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/axonixBidAdapter.js +1 -1
  19. package/dist/beyondmediaBidAdapter.js +1 -1
  20. package/dist/bidglassBidAdapter.js +1 -1
  21. package/dist/big-richmediaBidAdapter.js +1 -1
  22. package/dist/braveBidAdapter.js +1 -1
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/brightcomBidAdapter.js +1 -1
  26. package/dist/brightcomSSPBidAdapter.js +1 -1
  27. package/dist/carodaBidAdapter.js +1 -1
  28. package/dist/chtnwBidAdapter.js +1 -1
  29. package/dist/coinzillaBidAdapter.js +1 -1
  30. package/dist/compassBidAdapter.js +1 -1
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectIdSystem.js +1 -1
  33. package/dist/connectadBidAdapter.js +1 -1
  34. package/dist/consumableBidAdapter.js +1 -1
  35. package/dist/contentexchangeBidAdapter.js +1 -1
  36. package/dist/conversantAnalyticsAdapter.js +1 -1
  37. package/dist/conversantBidAdapter.js +1 -1
  38. package/dist/craftBidAdapter.js +1 -1
  39. package/dist/criteoBidAdapter.js +1 -1
  40. package/dist/cwireBidAdapter.js +1 -1
  41. package/dist/dependencies.json +12 -0
  42. package/dist/domainOverrideToRootDomain.js +1 -0
  43. package/dist/dspxBidAdapter.js +1 -1
  44. package/dist/eplanningBidAdapter.js +1 -1
  45. package/dist/feedadBidAdapter.js +1 -1
  46. package/dist/finativeBidAdapter.js +1 -1
  47. package/dist/freewheel-sspBidAdapter.js +1 -1
  48. package/dist/glimpseBidAdapter.js +1 -1
  49. package/dist/globalsunBidAdapter.js +1 -1
  50. package/dist/gmosspBidAdapter.js +1 -1
  51. package/dist/goldbachBidAdapter.js +1 -1
  52. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  53. package/dist/gridBidAdapter.js +1 -1
  54. package/dist/gridNMBidAdapter.js +1 -1
  55. package/dist/growthCodeIdSystem.js +1 -1
  56. package/dist/gumgumBidAdapter.js +1 -1
  57. package/dist/h12mediaBidAdapter.js +1 -1
  58. package/dist/id5IdSystem.js +1 -1
  59. package/dist/improvedigitalBidAdapter.js +1 -1
  60. package/dist/inmarBidAdapter.js +1 -1
  61. package/dist/insticatorBidAdapter.js +1 -1
  62. package/dist/iqzoneBidAdapter.js +1 -1
  63. package/dist/ivsBidAdapter.js +1 -0
  64. package/dist/ixBidAdapter.js +1 -1
  65. package/dist/justpremiumBidAdapter.js +1 -1
  66. package/dist/jwplayerVideoProvider.js +1 -1
  67. package/dist/kargoBidAdapter.js +1 -1
  68. package/dist/koblerBidAdapter.js +1 -1
  69. package/dist/konduitAnalyticsAdapter.js +1 -1
  70. package/dist/kueezBidAdapter.js +1 -1
  71. package/dist/kueezRtbBidAdapter.js +1 -1
  72. package/dist/kulturemediaBidAdapter.js +1 -1
  73. package/dist/lassoBidAdapter.js +1 -1
  74. package/dist/lifestreetBidAdapter.js +1 -1
  75. package/dist/liveIntentIdSystem.js +1 -1
  76. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  77. package/dist/logicadBidAdapter.js +1 -1
  78. package/dist/loglyliftBidAdapter.js +1 -1
  79. package/dist/luponmediaBidAdapter.js +1 -1
  80. package/dist/magniteAnalyticsAdapter.js +1 -1
  81. package/dist/malltvAnalyticsAdapter.js +1 -1
  82. package/dist/marsmediaBidAdapter.js +1 -1
  83. package/dist/mathildeadsBidAdapter.js +1 -1
  84. package/dist/mediafuseBidAdapter.js +1 -1
  85. package/dist/medianetBidAdapter.js +1 -1
  86. package/dist/mediasquareBidAdapter.js +1 -1
  87. package/dist/mgidBidAdapter.js +1 -1
  88. package/dist/minutemediaBidAdapter.js +1 -1
  89. package/dist/minutemediaplusBidAdapter.js +1 -1
  90. package/dist/nexx360BidAdapter.js +1 -1
  91. package/dist/not-for-prod/prebid.js +158 -156
  92. package/dist/oguryBidAdapter.js +1 -1
  93. package/dist/onetagBidAdapter.js +1 -1
  94. package/dist/onomagicBidAdapter.js +1 -1
  95. package/dist/ooloAnalyticsAdapter.js +1 -1
  96. package/dist/openxBidAdapter.js +1 -1
  97. package/dist/openxOrtbBidAdapter.js +1 -1
  98. package/dist/operaadsBidAdapter.js +1 -1
  99. package/dist/optidigitalBidAdapter.js +1 -1
  100. package/dist/outbrainBidAdapter.js +1 -1
  101. package/dist/parrableIdSystem.js +1 -1
  102. package/dist/pixfutureBidAdapter.js +1 -1
  103. package/dist/prebid-core.js +1 -1
  104. package/dist/publinkIdSystem.js +1 -1
  105. package/dist/pubmaticBidAdapter.js +1 -1
  106. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  107. package/dist/pubxBidAdapter.js +1 -1
  108. package/dist/pxyzBidAdapter.js +1 -1
  109. package/dist/quantcastBidAdapter.js +1 -1
  110. package/dist/readpeakBidAdapter.js +1 -1
  111. package/dist/relaidoBidAdapter.js +1 -1
  112. package/dist/rhythmoneBidAdapter.js +1 -1
  113. package/dist/riseBidAdapter.js +1 -1
  114. package/dist/rubiconAnalyticsAdapter.js +1 -1
  115. package/dist/rubiconBidAdapter.js +1 -1
  116. package/dist/seedingAllianceBidAdapter.js +1 -1
  117. package/dist/seedtagBidAdapter.js +1 -1
  118. package/dist/sharedIdSystem.js +1 -1
  119. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  120. package/dist/sharethroughBidAdapter.js +1 -1
  121. package/dist/shinezBidAdapter.js +1 -1
  122. package/dist/smaatoBidAdapter.js +1 -1
  123. package/dist/smartadserverBidAdapter.js +1 -1
  124. package/dist/smarthubBidAdapter.js +1 -1
  125. package/dist/smartxBidAdapter.js +1 -1
  126. package/dist/smilewantedBidAdapter.js +1 -1
  127. package/dist/sonobiBidAdapter.js +1 -1
  128. package/dist/sovrnAnalyticsAdapter.js +1 -1
  129. package/dist/sovrnBidAdapter.js +1 -1
  130. package/dist/sspBCBidAdapter.js +1 -1
  131. package/dist/stvBidAdapter.js +1 -1
  132. package/dist/sublimeBidAdapter.js +1 -1
  133. package/dist/synacormediaBidAdapter.js +1 -1
  134. package/dist/targetVideoBidAdapter.js +1 -1
  135. package/dist/teadsBidAdapter.js +1 -1
  136. package/dist/trionBidAdapter.js +1 -1
  137. package/dist/tripleliftBidAdapter.js +1 -1
  138. package/dist/truereachBidAdapter.js +1 -1
  139. package/dist/ttdBidAdapter.js +1 -1
  140. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  141. package/dist/uid2IdSystem.js +1 -1
  142. package/dist/underdogmediaBidAdapter.js +1 -1
  143. package/dist/undertoneBidAdapter.js +1 -1
  144. package/dist/userId.js +1 -1
  145. package/dist/vidazooBidAdapter.js +1 -1
  146. package/dist/videobyteBidAdapter.js +1 -1
  147. package/dist/videoheroesBidAdapter.js +1 -1
  148. package/dist/vidoomyBidAdapter.js +1 -1
  149. package/dist/visiblemeasuresBidAdapter.js +1 -1
  150. package/dist/visxBidAdapter.js +1 -1
  151. package/dist/vrtcalBidAdapter.js +1 -1
  152. package/dist/vuukleBidAdapter.js +1 -1
  153. package/dist/widespaceBidAdapter.js +1 -1
  154. package/dist/winrBidAdapter.js +1 -1
  155. package/dist/yahoosspBidAdapter.js +1 -1
  156. package/dist/yieldmoBidAdapter.js +1 -1
  157. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  158. package/dist/yieldoneBidAdapter.js +1 -1
  159. package/libraries/domainOverrideToRootDomain/index.js +39 -0
  160. package/modules/acuityAdsBidAdapter.js +1 -1
  161. package/modules/amxBidAdapter.js +1 -1
  162. package/modules/amxIdSystem.js +23 -20
  163. package/modules/amxIdSystem.md +7 -7
  164. package/modules/appushBidAdapter.js +1 -1
  165. package/modules/beyondmediaBidAdapter.js +1 -1
  166. package/modules/braveBidAdapter.js +1 -1
  167. package/modules/brightcomBidAdapter.js +1 -1
  168. package/modules/brightcomSSPBidAdapter.js +1 -1
  169. package/modules/coinzillaBidAdapter.js +1 -2
  170. package/modules/compassBidAdapter.js +1 -1
  171. package/modules/connectIdSystem.js +96 -21
  172. package/modules/connectIdSystem.md +6 -5
  173. package/modules/contentexchangeBidAdapter.js +1 -1
  174. package/modules/freewheel-sspBidAdapter.js +8 -0
  175. package/modules/glimpseBidAdapter.js +1 -2
  176. package/modules/globalsunBidAdapter.js +1 -1
  177. package/modules/gridBidAdapter.js +1 -1
  178. package/modules/gridNMBidAdapter.js +1 -1
  179. package/modules/growthCodeIdSystem.js +18 -15
  180. package/modules/gumgumBidAdapter.js +1 -1
  181. package/modules/iqzoneBidAdapter.js +1 -1
  182. package/modules/ivsBidAdapter.js +85 -0
  183. package/modules/ivsBidAdapter.md +34 -0
  184. package/modules/ixBidAdapter.js +42 -105
  185. package/modules/jwplayerVideoProvider.js +25 -32
  186. package/modules/koblerBidAdapter.js +1 -2
  187. package/modules/kueezBidAdapter.js +1 -1
  188. package/modules/liveIntentIdSystem.js +8 -0
  189. package/modules/luponmediaBidAdapter.js +1 -1
  190. package/modules/magniteAnalyticsAdapter.js +76 -3
  191. package/modules/mathildeadsBidAdapter.js +1 -1
  192. package/modules/medianetBidAdapter.js +1 -1
  193. package/modules/mgidBidAdapter.js +178 -26
  194. package/modules/minutemediaBidAdapter.js +1 -1
  195. package/modules/oguryBidAdapter.js +3 -2
  196. package/modules/onomagicBidAdapter.js +1 -2
  197. package/modules/openxBidAdapter.js +192 -563
  198. package/modules/openxBidAdapter.md +22 -20
  199. package/modules/openxOrtbBidAdapter.js +13 -11
  200. package/modules/openxOrtbBidAdapter.md +5 -3
  201. package/modules/operaadsBidAdapter.js +1 -1
  202. package/modules/pubmaticBidAdapter.js +1 -1
  203. package/modules/pubxBidAdapter.js +5 -2
  204. package/modules/riseBidAdapter.js +1 -1
  205. package/modules/sharedIdSystem.js +4 -27
  206. package/modules/sharethroughBidAdapter.js +1 -1
  207. package/modules/shinezBidAdapter.js +1 -1
  208. package/modules/smarthubBidAdapter.js +1 -1
  209. package/modules/synacormediaBidAdapter.js +1 -3
  210. package/modules/truereachBidAdapter.js +1 -2
  211. package/modules/userId/eids.js +18 -0
  212. package/modules/userId/eids.md +16 -0
  213. package/modules/videoheroesBidAdapter.js +1 -1
  214. package/modules/vidoomyBidAdapter.js +22 -1
  215. package/modules/visiblemeasuresBidAdapter.js +1 -1
  216. package/modules/vrtcalBidAdapter.js +1 -1
  217. package/modules/yieldoneBidAdapter.js +1 -1
  218. package/package.json +1 -1
  219. package/src/Renderer.js +2 -1
  220. package/src/native.js +5 -1
  221. package/test/spec/auctionmanager_spec.js +2 -2
  222. package/test/spec/libraries/domainOverrideToRootDomain/index_spec.js +77 -0
  223. package/test/spec/modules/acuityAdsBidAdapter_spec.js +2 -1
  224. package/test/spec/modules/amxIdSystem_spec.js +13 -26
  225. package/test/spec/modules/appushBidAdapter_spec.js +2 -1
  226. package/test/spec/modules/beyondmediaBidAdapter_spec.js +2 -1
  227. package/test/spec/modules/compassBidAdapter_spec.js +2 -1
  228. package/test/spec/modules/connectIdSystem_spec.js +420 -242
  229. package/test/spec/modules/contentexchangeBidAdapter_spec.js +2 -1
  230. package/test/spec/modules/eids_spec.js +30 -0
  231. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +37 -0
  232. package/test/spec/modules/globalsunBidAdapter_spec.js +2 -1
  233. package/test/spec/modules/iqzoneBidAdapter_spec.js +2 -1
  234. package/test/spec/modules/ivsBidAdapter_spec.js +197 -0
  235. package/test/spec/modules/ixBidAdapter_spec.js +84 -71
  236. package/test/spec/modules/koblerBidAdapter_spec.js +0 -20
  237. package/test/spec/modules/liveIntentIdSystem_spec.js +10 -0
  238. package/test/spec/modules/luponmediaBidAdapter_spec.js +1 -1
  239. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +129 -1
  240. package/test/spec/modules/mathildeadsBidAdapter_spec.js +2 -1
  241. package/test/spec/modules/mgidBidAdapter_spec.js +184 -36
  242. package/test/spec/modules/oguryBidAdapter_spec.js +19 -4
  243. package/test/spec/modules/openxBidAdapter_spec.js +1157 -1936
  244. package/test/spec/modules/openxOrtbBidAdapter_spec.js +12 -39
  245. package/test/spec/modules/pubxBidAdapter_spec.js +10 -2
  246. package/test/spec/modules/sharedIdSystem_spec.js +0 -46
  247. package/test/spec/modules/sharethroughBidAdapter_spec.js +2 -1
  248. package/test/spec/modules/smarthubBidAdapter_spec.js +2 -1
  249. package/test/spec/modules/synacormediaBidAdapter_spec.js +0 -26
  250. package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +17 -4
  251. package/test/spec/modules/vidoomyBidAdapter_spec.js +35 -0
  252. package/test/spec/modules/visiblemeasuresBidAdapter_spec.js +2 -1
  253. package/test/spec/modules/vrtcalBidAdapter_spec.js +3 -2
  254. package/test/spec/renderer_spec.js +1 -2
@@ -28,7 +28,8 @@ const {
28
28
  BIDDER_DONE,
29
29
  BID_WON,
30
30
  BID_TIMEOUT,
31
- BILLABLE_EVENT
31
+ BILLABLE_EVENT,
32
+ SEAT_NON_BID
32
33
  }
33
34
  } = CONSTANTS;
34
35
 
@@ -160,6 +161,16 @@ const MOCK = {
160
161
  'status': 'rendered',
161
162
  getStatusCode: () => 1,
162
163
  },
164
+ SEAT_NON_BID: {
165
+ auctionId: '99785e47-a7c8-4c8a-ae05-ef1c717a4b4d',
166
+ seatnonbid: [{
167
+ seat: 'rubicon',
168
+ nonbid: [{
169
+ status: 1,
170
+ impid: 'box'
171
+ }]
172
+ }]
173
+ },
163
174
  AUCTION_END: {
164
175
  'auctionId': '99785e47-a7c8-4c8a-ae05-ef1c717a4b4d',
165
176
  'auctionEnd': 1658868384019,
@@ -2039,4 +2050,121 @@ describe('magnite analytics adapter', function () {
2039
2050
  }
2040
2051
  })
2041
2052
  });
2053
+
2054
+ describe('BID_RESPONSE events', () => {
2055
+ beforeEach(() => {
2056
+ magniteAdapter.enableAnalytics({
2057
+ options: {
2058
+ endpoint: '//localhost:9999/event',
2059
+ accountId: 1001
2060
+ }
2061
+ });
2062
+ config.setConfig({ rubicon: { updatePageView: true } });
2063
+ });
2064
+
2065
+ it('should add a no-bid bid to the add unit if it recieves one from the server', () => {
2066
+ const bidResponse = utils.deepClone(MOCK.BID_RESPONSE);
2067
+ const auctionInit = utils.deepClone(MOCK.AUCTION_INIT);
2068
+
2069
+ bidResponse.requestId = 'fakeId';
2070
+ bidResponse.seatBidId = 'fakeId';
2071
+
2072
+ bidResponse.requestId = 'fakeId';
2073
+ events.emit(AUCTION_INIT, auctionInit);
2074
+ events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
2075
+ events.emit(BID_RESPONSE, bidResponse)
2076
+ events.emit(BIDDER_DONE, MOCK.BIDDER_DONE);
2077
+ events.emit(AUCTION_END, MOCK.AUCTION_END);
2078
+ clock.tick(rubiConf.analyticsBatchTimeout + 1000);
2079
+
2080
+ let message = JSON.parse(server.requests[0].requestBody);
2081
+ expect(utils.generateUUID.called).to.equal(true);
2082
+
2083
+ expect(message.auctions[0].adUnits[0].bids[1]).to.deep.equal(
2084
+ {
2085
+ bidder: 'rubicon',
2086
+ source: 'server',
2087
+ status: 'success',
2088
+ bidResponse: {
2089
+ 'bidPriceUSD': 3.4,
2090
+ 'dimensions': {
2091
+ 'height': 250,
2092
+ 'width': 300
2093
+ },
2094
+ 'mediaType': 'banner'
2095
+ },
2096
+ oldBidId: 'fakeId',
2097
+ unknownBid: true,
2098
+ bidId: 'fakeId',
2099
+ clientLatencyMillis: 271
2100
+ }
2101
+ );
2102
+ });
2103
+ });
2104
+
2105
+ describe('SEAT_NON_BID events', () => {
2106
+ let seatnonbid;
2107
+
2108
+ const runNonBidAuction = () => {
2109
+ events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
2110
+ events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
2111
+ events.emit(SEAT_NON_BID, seatnonbid)
2112
+ events.emit(BIDDER_DONE, MOCK.BIDDER_DONE);
2113
+ events.emit(AUCTION_END, MOCK.AUCTION_END);
2114
+ clock.tick(rubiConf.analyticsBatchTimeout + 1000);
2115
+ };
2116
+ const checkStatusAgainstCode = (status, code, error, index) => {
2117
+ seatnonbid.seatnonbid[0].nonbid[0].status = code;
2118
+ runNonBidAuction();
2119
+ let message = JSON.parse(server.requests[index].requestBody);
2120
+ let bid = message.auctions[0].adUnits[0].bids[1];
2121
+
2122
+ if (error) {
2123
+ expect(bid.error).to.deep.equal(error);
2124
+ } else {
2125
+ expect(bid.error).to.equal(undefined);
2126
+ }
2127
+ expect(bid.source).to.equal('server');
2128
+ expect(bid.status).to.equal(status);
2129
+ expect(bid.isSeatNonBid).to.equal(true);
2130
+ };
2131
+ beforeEach(() => {
2132
+ magniteAdapter.enableAnalytics({
2133
+ options: {
2134
+ endpoint: '//localhost:9999/event',
2135
+ accountId: 1001
2136
+ }
2137
+ });
2138
+ seatnonbid = utils.deepClone(MOCK.SEAT_NON_BID);
2139
+ });
2140
+
2141
+ it('adds seatnonbid info to bids array', () => {
2142
+ runNonBidAuction();
2143
+ let message = JSON.parse(server.requests[0].requestBody);
2144
+
2145
+ expect(message.auctions[0].adUnits[0].bids[1]).to.deep.equal(
2146
+ {
2147
+ bidder: 'rubicon',
2148
+ source: 'server',
2149
+ status: 'no-bid',
2150
+ isSeatNonBid: true,
2151
+ clientLatencyMillis: -139101369960
2152
+ }
2153
+ );
2154
+ });
2155
+
2156
+ it('adjusts the status according to the status map', () => {
2157
+ const statuses = [
2158
+ {code: 0, status: 'no-bid'},
2159
+ {code: 100, status: 'error', error: {code: 'request-error', description: 'general error'}},
2160
+ {code: 101, status: 'error', error: {code: 'timeout-error', description: 'prebid server timeout'}},
2161
+ {code: 200, status: 'rejected'},
2162
+ {code: 202, status: 'rejected'},
2163
+ {code: 301, status: 'rejected-ipf'}
2164
+ ];
2165
+ statuses.forEach((info, index) => {
2166
+ checkStatusAgainstCode(info.status, info.code, info.error, index);
2167
+ });
2168
+ });
2169
+ });
2042
2170
  });
@@ -74,7 +74,8 @@ describe('MathildeAdsBidAdapter', function () {
74
74
  gdprConsent: 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
75
75
  refererInfo: {
76
76
  referer: 'https://test.com'
77
- }
77
+ },
78
+ timeout: 500
78
79
  };
79
80
 
80
81
  describe('isBidRequestValid', function () {
@@ -1,7 +1,9 @@
1
- import {assert, expect} from 'chai';
1
+ import {expect} from 'chai';
2
2
  import { spec, storage } from 'modules/mgidBidAdapter.js';
3
3
  import { version } from 'package.json';
4
4
  import * as utils from '../../../src/utils.js';
5
+ import {USERSYNC_DEFAULT_CONFIG} from '../../../src/userSync';
6
+ import {config} from '../../../src/config';
5
7
 
6
8
  describe('Mgid bid adapter', function () {
7
9
  let sandbox;
@@ -21,10 +23,10 @@ describe('Mgid bid adapter', function () {
21
23
  const ua = navigator.userAgent;
22
24
  const screenHeight = screen.height;
23
25
  const screenWidth = screen.width;
24
- const dnt = (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0;
26
+ const dnt = (navigator.doNotTrack === 'yes' || navigator.doNotTrack === '1' || navigator.msDoNotTrack === '1') ? 1 : 0;
25
27
  const language = navigator.language ? 'language' : 'userLanguage';
26
28
  let lang = navigator[language].split('-')[0];
27
- if (lang.length != 2 && lang.length != 3) {
29
+ if (lang.length !== 2 && lang.length !== 3) {
28
30
  lang = '';
29
31
  }
30
32
  const secure = window.location.protocol === 'https:' ? 1 : 0;
@@ -36,7 +38,7 @@ describe('Mgid bid adapter', function () {
36
38
  });
37
39
 
38
40
  describe('isBidRequestValid', function () {
39
- let bid = {
41
+ let sbid = {
40
42
  'adUnitCode': 'div',
41
43
  'bidder': 'mgid',
42
44
  'params': {
@@ -46,26 +48,26 @@ describe('Mgid bid adapter', function () {
46
48
  };
47
49
 
48
50
  it('should not accept bid without required params', function () {
49
- let isValid = spec.isBidRequestValid(bid);
51
+ let isValid = spec.isBidRequestValid(sbid);
50
52
  expect(isValid).to.equal(false);
51
53
  });
52
54
 
53
55
  it('should return false when params are not passed', function () {
54
- let bid = Object.assign({}, bid);
56
+ let bid = Object.assign({}, sbid);
55
57
  delete bid.params;
56
58
  bid.params = {};
57
59
  expect(spec.isBidRequestValid(bid)).to.equal(false);
58
60
  });
59
61
 
60
62
  it('should return false when valid params are not passed', function () {
61
- let bid = Object.assign({}, bid);
63
+ let bid = Object.assign({}, sbid);
62
64
  delete bid.params;
63
65
  bid.params = {accountId: '', placementId: ''};
64
66
  expect(spec.isBidRequestValid(bid)).to.equal(false);
65
67
  });
66
68
 
67
69
  it('should return false when valid params are not passed', function () {
68
- let bid = Object.assign({}, bid);
70
+ let bid = Object.assign({}, sbid);
69
71
  delete bid.params;
70
72
  bid.adUnitCode = '';
71
73
  bid.mediaTypes = {
@@ -78,7 +80,7 @@ describe('Mgid bid adapter', function () {
78
80
  });
79
81
 
80
82
  it('should return false when adUnitCode not passed', function () {
81
- let bid = Object.assign({}, bid);
83
+ let bid = Object.assign({}, sbid);
82
84
  delete bid.params;
83
85
  bid.adUnitCode = '';
84
86
  bid.mediaTypes = {
@@ -91,7 +93,7 @@ describe('Mgid bid adapter', function () {
91
93
  });
92
94
 
93
95
  it('should return true when valid params are passed as nums', function () {
94
- let bid = Object.assign({}, bid);
96
+ let bid = Object.assign({}, sbid);
95
97
  delete bid.params;
96
98
  bid.adUnitCode = 'div';
97
99
  bid.mediaTypes = {
@@ -104,7 +106,7 @@ describe('Mgid bid adapter', function () {
104
106
  });
105
107
 
106
108
  it('should return false when valid params are not passed', function () {
107
- let bid = Object.assign({}, bid);
109
+ let bid = Object.assign({}, sbid);
108
110
  delete bid.params;
109
111
  bid.mediaTypes = {
110
112
  native: {
@@ -116,14 +118,14 @@ describe('Mgid bid adapter', function () {
116
118
  });
117
119
 
118
120
  it('should return false when valid mediaTypes are not passed', function () {
119
- let bid = Object.assign({}, bid);
121
+ let bid = Object.assign({}, sbid);
120
122
  delete bid.params;
121
123
  bid.params = {accountId: '1', placementId: '1'};
122
124
  expect(spec.isBidRequestValid(bid)).to.equal(false);
123
125
  });
124
126
 
125
127
  it('should return false when valid mediaTypes.banner are not passed', function () {
126
- let bid = Object.assign({}, bid);
128
+ let bid = Object.assign({}, sbid);
127
129
  delete bid.params;
128
130
  bid.params = {accountId: '1', placementId: '1'};
129
131
  bid.mediaTypes = {
@@ -132,7 +134,7 @@ describe('Mgid bid adapter', function () {
132
134
  });
133
135
 
134
136
  it('should return false when valid mediaTypes.banner.sizes are not passed', function () {
135
- let bid = Object.assign({}, bid);
137
+ let bid = Object.assign({}, sbid);
136
138
  delete bid.params;
137
139
  bid.params = {accountId: '1', placementId: '1'};
138
140
  bid.mediaTypes = {
@@ -142,7 +144,7 @@ describe('Mgid bid adapter', function () {
142
144
  });
143
145
 
144
146
  it('should return false when valid mediaTypes.banner.sizes are not valid', function () {
145
- let bid = Object.assign({}, bid);
147
+ let bid = Object.assign({}, sbid);
146
148
  delete bid.params;
147
149
  bid.params = {accountId: '1', placementId: '1'};
148
150
  bid.mediaTypes = {
@@ -152,7 +154,7 @@ describe('Mgid bid adapter', function () {
152
154
  });
153
155
 
154
156
  it('should return true when valid params are passed as strings', function () {
155
- let bid = Object.assign({}, bid);
157
+ let bid = Object.assign({}, sbid);
156
158
  delete bid.params;
157
159
  bid.adUnitCode = 'div';
158
160
  bid.params = {accountId: '1', placementId: '1'};
@@ -165,7 +167,7 @@ describe('Mgid bid adapter', function () {
165
167
  });
166
168
 
167
169
  it('should return false when valid mediaTypes.native is not object', function () {
168
- let bid = Object.assign({}, bid);
170
+ let bid = Object.assign({}, sbid);
169
171
  bid.params = {accountId: '1', placementId: '1'};
170
172
  bid.mediaTypes = {
171
173
  native: []
@@ -174,7 +176,7 @@ describe('Mgid bid adapter', function () {
174
176
  });
175
177
 
176
178
  it('should return false when mediaTypes.native is empty object', function () {
177
- let bid = Object.assign({}, bid);
179
+ let bid = Object.assign({}, sbid);
178
180
  delete bid.params;
179
181
  bid.params = {accountId: '1', placementId: '1'};
180
182
  bid.mediaTypes = {
@@ -184,7 +186,7 @@ describe('Mgid bid adapter', function () {
184
186
  });
185
187
 
186
188
  it('should return false when mediaTypes.native is invalid object', function () {
187
- let bid = Object.assign({}, bid);
189
+ let bid = Object.assign({}, sbid);
188
190
  delete bid.params;
189
191
  bid.params = {accountId: '1', placementId: '1'};
190
192
  bid.mediaTypes = {
@@ -198,7 +200,7 @@ describe('Mgid bid adapter', function () {
198
200
  });
199
201
 
200
202
  it('should return false when mediaTypes.native has unsupported required asset', function () {
201
- let bid = Object.assign({}, bid);
203
+ let bid = Object.assign({}, sbid);
202
204
  bid.params = {accountId: '2', placementId: '1'};
203
205
  bid.mediaTypes = {
204
206
  native: {
@@ -217,7 +219,7 @@ describe('Mgid bid adapter', function () {
217
219
  });
218
220
 
219
221
  it('should return true when mediaTypes.native all assets needed', function () {
220
- let bid = Object.assign({}, bid);
222
+ let bid = Object.assign({}, sbid);
221
223
  bid.adUnitCode = 'div';
222
224
  bid.params = {accountId: '2', placementId: '1'};
223
225
  bid.mediaTypes = {
@@ -237,7 +239,7 @@ describe('Mgid bid adapter', function () {
237
239
  });
238
240
 
239
241
  describe('override defaults', function () {
240
- let bid = {
242
+ let sbid = {
241
243
  bidder: 'mgid',
242
244
  params: {
243
245
  accountId: '1',
@@ -245,7 +247,7 @@ describe('Mgid bid adapter', function () {
245
247
  },
246
248
  };
247
249
  it('should return object', function () {
248
- let bid = Object.assign({}, bid);
250
+ let bid = Object.assign({}, sbid);
249
251
  bid.mediaTypes = {
250
252
  banner: {
251
253
  sizes: [[300, 250]]
@@ -257,7 +259,7 @@ describe('Mgid bid adapter', function () {
257
259
  });
258
260
 
259
261
  it('should return overwrite default bidurl', function () {
260
- let bid = Object.assign({}, bid);
262
+ let bid = Object.assign({}, sbid);
261
263
  bid.params = {
262
264
  bidUrl: 'https://newbidurl.com/',
263
265
  accountId: '1',
@@ -273,7 +275,7 @@ describe('Mgid bid adapter', function () {
273
275
  expect(request.url).to.include('https://newbidurl.com/1');
274
276
  });
275
277
  it('should return overwrite default bidFloor', function () {
276
- let bid = Object.assign({}, bid);
278
+ let bid = Object.assign({}, sbid);
277
279
  bid.params = {
278
280
  bidFloor: 1.1,
279
281
  accountId: '1',
@@ -294,7 +296,7 @@ describe('Mgid bid adapter', function () {
294
296
  expect(data.imp[0].bidfloor).to.deep.equal(1.1);
295
297
  });
296
298
  it('should return overwrite default currency', function () {
297
- let bid = Object.assign({}, bid);
299
+ let bid = Object.assign({}, sbid);
298
300
  bid.params = {
299
301
  cur: 'GBP',
300
302
  accountId: '1',
@@ -323,6 +325,9 @@ describe('Mgid bid adapter', function () {
323
325
  placementId: '2',
324
326
  },
325
327
  };
328
+ afterEach(function () {
329
+ config.setConfig({coppa: undefined})
330
+ })
326
331
 
327
332
  it('should return undefined if no validBidRequests passed', function () {
328
333
  expect(spec.buildRequests([])).to.be.undefined;
@@ -344,6 +349,7 @@ describe('Mgid bid adapter', function () {
344
349
  getDataFromLocalStorageStub.restore();
345
350
  });
346
351
  it('should proper handle gdpr', function () {
352
+ config.setConfig({coppa: 1})
347
353
  let bid = Object.assign({}, abid);
348
354
  bid.mediaTypes = {
349
355
  banner: {
@@ -351,12 +357,72 @@ describe('Mgid bid adapter', function () {
351
357
  }
352
358
  };
353
359
  let bidRequests = [bid];
354
- const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'gdpr', gdprApplies: true}});
360
+ const request = spec.buildRequests(bidRequests, {gdprConsent: {consentString: 'gdpr', gdprApplies: true}, uspConsent: 'usp', gppConsent: {gppString: 'gpp'}});
355
361
  expect(request.url).deep.equal('https://prebid.mgid.com/prebid/1');
356
362
  expect(request.method).deep.equal('POST');
357
363
  const data = JSON.parse(request.data);
358
364
  expect(data.user).deep.equal({ext: {consent: 'gdpr'}});
359
- expect(data.regs).deep.equal({ext: {gdpr: 1}});
365
+ expect(data.regs).deep.equal({ext: {gdpr: 1, us_privacy: 'usp'}, gpp: 'gpp', coppa: 1});
366
+ });
367
+ it('should handle refererInfo', function () {
368
+ let bid = Object.assign({}, abid);
369
+ bid.mediaTypes = {
370
+ banner: {
371
+ sizes: [[300, 250]]
372
+ }
373
+ };
374
+ let bidRequests = [bid];
375
+ const domain = 'site.com'
376
+ const page = `http://${domain}/site.html`
377
+ const ref = 'http://ref.com/ref.html'
378
+ const request = spec.buildRequests(bidRequests, {refererInfo: {page, ref}});
379
+ expect(request.url).deep.equal('https://prebid.mgid.com/prebid/1');
380
+ expect(request.method).deep.equal('POST');
381
+ const data = JSON.parse(request.data);
382
+ expect(data.site.domain).to.deep.equal(domain);
383
+ expect(data.site.page).to.deep.equal(page);
384
+ expect(data.site.ref).to.deep.equal(ref);
385
+ });
386
+ it('should handle schain', function () {
387
+ let bid = Object.assign({}, abid);
388
+ bid.mediaTypes = {
389
+ banner: {
390
+ sizes: [[300, 250]]
391
+ }
392
+ };
393
+ bid.schain = ['schain1', 'schain2'];
394
+ let bidRequests = [bid];
395
+ const request = spec.buildRequests(bidRequests);
396
+ const data = JSON.parse(request.data);
397
+ expect(data.source).to.deep.equal({ext: {schain: bid.schain}});
398
+ });
399
+ it('should handle userId', function () {
400
+ let bid = Object.assign({}, abid);
401
+ bid.mediaTypes = {
402
+ banner: {
403
+ sizes: [[300, 250]]
404
+ }
405
+ };
406
+ let bidRequests = [bid];
407
+ const bidderRequest = {userId: 'userid'};
408
+ const request = spec.buildRequests(bidRequests, bidderRequest);
409
+ expect(request.url).deep.equal('https://prebid.mgid.com/prebid/1');
410
+ expect(request.method).deep.equal('POST');
411
+ const data = JSON.parse(request.data);
412
+ expect(data.user.id).to.deep.equal(bidderRequest.userId);
413
+ });
414
+ it('should handle eids', function () {
415
+ let bid = Object.assign({}, abid);
416
+ bid.mediaTypes = {
417
+ banner: {
418
+ sizes: [[300, 250]]
419
+ }
420
+ };
421
+ bid.userIdAsEids = ['eid1', 'eid2']
422
+ let bidRequests = [bid];
423
+ const request = spec.buildRequests(bidRequests);
424
+ const data = JSON.parse(request.data);
425
+ expect(data.user.ext.eids).to.deep.equal(bid.userIdAsEids);
360
426
  });
361
427
  it('should return proper banner imp', function () {
362
428
  let bid = Object.assign({}, abid);
@@ -386,7 +452,7 @@ describe('Mgid bid adapter', function () {
386
452
  expect(request).to.deep.equal({
387
453
  'method': 'POST',
388
454
  'url': 'https://prebid.mgid.com/prebid/1',
389
- 'data': '{"site":{"domain":"' + domain + '","page":"' + page + '"},"cur":["USD"],"geo":{"utcoffset":' + utcOffset + '},"device":{"ua":"' + ua + '","js":1,"dnt":' + dnt + ',"h":' + screenHeight + ',"w":' + screenWidth + ',"language":"' + lang + '"},"ext":{"mgid_ver":"' + mgid_ver + '","prebid_ver":"' + version + '"},"imp":[{"tagid":"2/div","secure":' + secure + ',"banner":{"w":300,"h":250}}]}',
455
+ 'data': `{"site":{"domain":"${domain}","page":"${page}"},"cur":["USD"],"geo":{"utcoffset":${utcOffset}},"device":{"ua":"${ua}","js":1,"dnt":${dnt},"h":${screenHeight},"w":${screenWidth},"language":"${lang}"},"ext":{"mgid_ver":"${mgid_ver}","prebid_ver":"${version}"},"imp":[{"tagid":"2/div","secure":${secure},"banner":{"w":300,"h":250}}],"tmax":3000}`,
390
456
  });
391
457
  });
392
458
  it('should not return native imp if minimum asset list not requested', function () {
@@ -435,7 +501,7 @@ describe('Mgid bid adapter', function () {
435
501
  expect(request).to.deep.equal({
436
502
  'method': 'POST',
437
503
  'url': 'https://prebid.mgid.com/prebid/1',
438
- 'data': '{"site":{"domain":"' + domain + '","page":"' + page + '"},"cur":["USD"],"geo":{"utcoffset":' + utcOffset + '},"device":{"ua":"' + ua + '","js":1,"dnt":' + dnt + ',"h":' + screenHeight + ',"w":' + screenWidth + ',"language":"' + lang + '"},"ext":{"mgid_ver":"' + mgid_ver + '","prebid_ver":"' + version + '"},"imp":[{"tagid":"2/div","secure":' + secure + ',"native":{"request":{"plcmtcnt":1,"assets":[{"id":1,"required":1,"title":{"len":80}},{"id":2,"required":0,"img":{"type":3,"w":80,"h":80}},{"id":11,"required":0,"data":{"type":1}}]}}}]}',
504
+ 'data': `{"site":{"domain":"${domain}","page":"${page}"},"cur":["USD"],"geo":{"utcoffset":${utcOffset}},"device":{"ua":"${ua}","js":1,"dnt":${dnt},"h":${screenHeight},"w":${screenWidth},"language":"${lang}"},"ext":{"mgid_ver":"${mgid_ver}","prebid_ver":"${version}"},"imp":[{"tagid":"2/div","secure":${secure},"native":{"request":{"plcmtcnt":1,"assets":[{"id":1,"required":1,"title":{"len":80}},{"id":2,"required":0,"img":{"type":3,"w":80,"h":80}},{"id":11,"required":0,"data":{"type":1}}]}}}],"tmax":3000}`,
439
505
  });
440
506
  });
441
507
  it('should return proper native imp with image altered', function () {
@@ -472,7 +538,7 @@ describe('Mgid bid adapter', function () {
472
538
  expect(request).to.deep.equal({
473
539
  'method': 'POST',
474
540
  'url': 'https://prebid.mgid.com/prebid/1',
475
- 'data': '{"site":{"domain":"' + domain + '","page":"' + page + '"},"cur":["USD"],"geo":{"utcoffset":' + utcOffset + '},"device":{"ua":"' + ua + '","js":1,"dnt":' + dnt + ',"h":' + screenHeight + ',"w":' + screenWidth + ',"language":"' + lang + '"},"ext":{"mgid_ver":"' + mgid_ver + '","prebid_ver":"' + version + '"},"imp":[{"tagid":"2/div","secure":' + secure + ',"native":{"request":{"plcmtcnt":1,"assets":[{"id":1,"required":1,"title":{"len":80}},{"id":2,"required":1,"img":{"type":3,"w":492,"h":328,"wmin":50,"hmin":50}},{"id":3,"required":0,"img":{"type":1,"w":50,"h":50}},{"id":11,"required":0,"data":{"type":1}}]}}}]}',
541
+ 'data': `{"site":{"domain":"${domain}","page":"${page}"},"cur":["USD"],"geo":{"utcoffset":${utcOffset}},"device":{"ua":"${ua}","js":1,"dnt":${dnt},"h":${screenHeight},"w":${screenWidth},"language":"${lang}"},"ext":{"mgid_ver":"${mgid_ver}","prebid_ver":"${version}"},"imp":[{"tagid":"2/div","secure":${secure},"native":{"request":{"plcmtcnt":1,"assets":[{"id":1,"required":1,"title":{"len":80}},{"id":2,"required":1,"img":{"type":3,"w":492,"h":328,"wmin":50,"hmin":50}},{"id":3,"required":0,"img":{"type":1,"w":50,"h":50}},{"id":11,"required":0,"data":{"type":1}}]}}}],"tmax":3000}`,
476
542
  });
477
543
  });
478
544
  it('should return proper native imp with sponsoredBy', function () {
@@ -508,7 +574,7 @@ describe('Mgid bid adapter', function () {
508
574
  expect(request).to.deep.equal({
509
575
  'method': 'POST',
510
576
  'url': 'https://prebid.mgid.com/prebid/1',
511
- 'data': '{"site":{"domain":"' + domain + '","page":"' + page + '"},"cur":["USD"],"geo":{"utcoffset":' + utcOffset + '},"device":{"ua":"' + ua + '","js":1,"dnt":' + dnt + ',"h":' + screenHeight + ',"w":' + screenWidth + ',"language":"' + lang + '"},"ext":{"mgid_ver":"' + mgid_ver + '","prebid_ver":"' + version + '"},"imp":[{"tagid":"2/div","secure":' + secure + ',"native":{"request":{"plcmtcnt":1,"assets":[{"id":1,"required":1,"title":{"len":80}},{"id":2,"required":0,"img":{"type":3,"w":80,"h":80}},{"id":4,"required":0,"data":{"type":1}}]}}}]}',
577
+ 'data': `{"site":{"domain":"${domain}","page":"${page}"},"cur":["USD"],"geo":{"utcoffset":${utcOffset}},"device":{"ua":"${ua}","js":1,"dnt":${dnt},"h":${screenHeight},"w":${screenWidth},"language":"${lang}"},"ext":{"mgid_ver":"${mgid_ver}","prebid_ver":"${version}"},"imp":[{"tagid":"2/div","secure":${secure},"native":{"request":{"plcmtcnt":1,"assets":[{"id":1,"required":1,"title":{"len":80}},{"id":2,"required":0,"img":{"type":3,"w":80,"h":80}},{"id":4,"required":0,"data":{"type":1}}]}}}],"tmax":3000}`,
512
578
  });
513
579
  });
514
580
  it('should return proper banner request', function () {
@@ -542,7 +608,7 @@ describe('Mgid bid adapter', function () {
542
608
  expect(request).to.deep.equal({
543
609
  'method': 'POST',
544
610
  'url': 'https://prebid.mgid.com/prebid/1',
545
- 'data': '{"site":{"domain":"' + domain + '","page":"' + page + '"},"cur":["USD"],"geo":{"utcoffset":' + utcOffset + '},"device":{"ua":"' + ua + '","js":1,"dnt":' + dnt + ',"h":' + screenHeight + ',"w":' + screenWidth + ',"language":"' + lang + '"},"ext":{"mgid_ver":"' + mgid_ver + '","prebid_ver":"' + version + '"},"imp":[{"tagid":"2/div","secure":' + secure + ',"banner":{"w":300,"h":600,"format":[{"w":300,"h":600},{"w":300,"h":250}],"pos":1}}]}',
611
+ 'data': `{"site":{"domain":"${domain}","page":"${page}"},"cur":["USD"],"geo":{"utcoffset":${utcOffset}},"device":{"ua":"${ua}","js":1,"dnt":${dnt},"h":${screenHeight},"w":${screenWidth},"language":"${lang}"},"ext":{"mgid_ver":"${mgid_ver}","prebid_ver":"${version}"},"imp":[{"tagid":"2/div","secure":${secure},"banner":{"w":300,"h":600,"format":[{"w":300,"h":600},{"w":300,"h":250}],"pos":1}}],"tmax":3000}`,
546
612
  });
547
613
  });
548
614
  it('should proper handle ortb2 data', function () {
@@ -555,7 +621,14 @@ describe('Mgid bid adapter', function () {
555
621
  let bidRequests = [bid];
556
622
 
557
623
  let bidderRequest = {
624
+ gdprConsent: {
625
+ consentString: 'consent1',
626
+ gdprApplies: false,
627
+ },
558
628
  ortb2: {
629
+ bcat: ['bcat1', 'bcat2'],
630
+ badv: ['badv1.com', 'badv2.com'],
631
+ wlang: ['l1', 'l2'],
559
632
  site: {
560
633
  content: {
561
634
  data: [{
@@ -571,6 +644,9 @@ describe('Mgid bid adapter', function () {
571
644
  }
572
645
  },
573
646
  user: {
647
+ ext: {
648
+ consent: 'consent2 ',
649
+ },
574
650
  data: [{
575
651
  name: 'mgid.com',
576
652
  ext: {
@@ -581,6 +657,11 @@ describe('Mgid bid adapter', function () {
581
657
  {'id': '987'},
582
658
  ],
583
659
  }]
660
+ },
661
+ regs: {
662
+ ext: {
663
+ gdpr: 1,
664
+ }
584
665
  }
585
666
  }
586
667
  };
@@ -589,7 +670,13 @@ describe('Mgid bid adapter', function () {
589
670
  expect(request.url).deep.equal('https://prebid.mgid.com/prebid/1');
590
671
  expect(request.method).deep.equal('POST');
591
672
  const data = JSON.parse(request.data);
592
- expect(data.ext).deep.include(bidderRequest.ortb2);
673
+ expect(data.bcat).deep.equal(bidderRequest.ortb2.bcat);
674
+ expect(data.badv).deep.equal(bidderRequest.ortb2.badv);
675
+ expect(data.wlang).deep.equal(bidderRequest.ortb2.wlang);
676
+ expect(data.site.content).deep.equal(bidderRequest.ortb2.site.content);
677
+ expect(data.regs).deep.equal(bidderRequest.ortb2.regs);
678
+ expect(data.user.data).deep.equal(bidderRequest.ortb2.user.data);
679
+ expect(data.user.ext).deep.equal(bidderRequest.ortb2.user.ext);
593
680
  });
594
681
  });
595
682
 
@@ -727,8 +814,69 @@ describe('Mgid bid adapter', function () {
727
814
  });
728
815
 
729
816
  describe('getUserSyncs', function () {
730
- it('should do nothing on getUserSyncs', function () {
731
- spec.getUserSyncs()
817
+ afterEach(function() {
818
+ config.setConfig({userSync: {syncsPerBidder: USERSYNC_DEFAULT_CONFIG.syncsPerBidder}});
819
+ });
820
+ it('should do nothing on getUserSyncs without inputs', function () {
821
+ expect(spec.getUserSyncs()).to.equal(undefined)
822
+ });
823
+ it('should return frame object with empty consents', function () {
824
+ const sync = spec.getUserSyncs({iframeEnabled: true})
825
+ expect(sync).to.have.length(1)
826
+ expect(sync[0]).to.have.property('type', 'iframe')
827
+ expect(sync[0]).to.have.property('url').match(/https:\/\/cm\.mgid\.com\/i\.html\?cbuster=\d+&consentData=&gdprApplies=0/)
828
+ });
829
+ it('should return frame object with gdpr consent', function () {
830
+ const sync = spec.getUserSyncs({iframeEnabled: true}, undefined, {consentString: 'consent', gdprApplies: true})
831
+ expect(sync).to.have.length(1)
832
+ expect(sync[0]).to.have.property('type', 'iframe')
833
+ expect(sync[0]).to.have.property('url').match(/https:\/\/cm\.mgid\.com\/i\.html\?cbuster=\d+&consentData=consent&gdprApplies=1/)
834
+ });
835
+ it('should return frame object with gdpr + usp', function () {
836
+ const sync = spec.getUserSyncs({iframeEnabled: true}, undefined, {consentString: 'consent1', gdprApplies: true}, {'consentString': 'consent2'})
837
+ expect(sync).to.have.length(1)
838
+ expect(sync[0]).to.have.property('type', 'iframe')
839
+ expect(sync[0]).to.have.property('url').match(/https:\/\/cm\.mgid\.com\/i\.html\?cbuster=\d+&consentData=consent1&gdprApplies=1&uspString=consent2/)
840
+ });
841
+ it('should return img object with gdpr + usp', function () {
842
+ config.setConfig({userSync: {syncsPerBidder: undefined}});
843
+ const sync = spec.getUserSyncs({pixelEnabled: true}, undefined, {consentString: 'consent1', gdprApplies: true}, {'consentString': 'consent2'})
844
+ expect(sync).to.have.length(USERSYNC_DEFAULT_CONFIG.syncsPerBidder)
845
+ for (let i = 0; i < USERSYNC_DEFAULT_CONFIG.syncsPerBidder; i++) {
846
+ expect(sync[i]).to.have.property('type', 'image')
847
+ expect(sync[i]).to.have.property('url').match(/https:\/\/cm\.mgid\.com\/i\.gif\?cbuster=\d+&consentData=consent1&gdprApplies=1&uspString=consent2/)
848
+ }
849
+ });
850
+ it('should return frame object with gdpr + usp', function () {
851
+ const sync = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, undefined, {consentString: 'consent1', gdprApplies: true}, {'consentString': 'consent2'})
852
+ expect(sync).to.have.length(1)
853
+ expect(sync[0]).to.have.property('type', 'iframe')
854
+ expect(sync[0]).to.have.property('url').match(/https:\/\/cm\.mgid\.com\/i\.html\?cbuster=\d+&consentData=consent1&gdprApplies=1&uspString=consent2/)
855
+ });
856
+ it('should return img (pixels) objects with gdpr + usp', function () {
857
+ const response = [{body: {ext: {cm: ['http://cm.mgid.com/i.gif?cdsp=1111', 'http://cm.mgid.com/i.gif']}}}]
858
+ const sync = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, response, {consentString: 'consent1', gdprApplies: true}, {'consentString': 'consent2'})
859
+ expect(sync).to.have.length(2)
860
+ expect(sync[0]).to.have.property('type', 'image')
861
+ expect(sync[0]).to.have.property('url').match(/http:\/\/cm\.mgid\.com\/i\.gif\?cdsp=1111&cbuster=\d+&consentData=consent1&gdprApplies=1&uspString=consent2/)
862
+ expect(sync[1]).to.have.property('type', 'image')
863
+ expect(sync[1]).to.have.property('url').match(/http:\/\/cm\.mgid\.com\/i\.gif\?cbuster=\d+&consentData=consent1&gdprApplies=1&uspString=consent2/)
864
+ });
865
+ });
866
+
867
+ describe('getUserSyncs with img from ext.cm and gdpr + usp + coppa + gpp', function () {
868
+ afterEach(function() {
869
+ config.setConfig({coppa: undefined})
870
+ });
871
+ it('should return img (pixels) objects with gdpr + usp + coppa + gpp', function () {
872
+ config.setConfig({coppa: 1});
873
+ const response = [{body: {ext: {cm: ['http://cm.mgid.com/i.gif?cdsp=1111', 'http://cm.mgid.com/i.gif']}}}]
874
+ const sync = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, response, {consentString: 'consent1', gdprApplies: true}, {'consentString': 'consent2'}, {gppString: 'gpp'})
875
+ expect(sync).to.have.length(2)
876
+ expect(sync[0]).to.have.property('type', 'image')
877
+ expect(sync[0]).to.have.property('url').match(/http:\/\/cm\.mgid\.com\/i\.gif\?cdsp=1111&cbuster=\d+&consentData=consent1&gdprApplies=1&uspString=consent2&gppString=gpp&coppa=1/)
878
+ expect(sync[1]).to.have.property('type', 'image')
879
+ expect(sync[1]).to.have.property('url').match(/http:\/\/cm\.mgid\.com\/i\.gif\?cbuster=\d+&consentData=consent1&gdprApplies=1&uspString=consent2&gppString=gpp&coppa=1/)
732
880
  });
733
881
  });
734
882