prebid.js 7.3.0 → 7.4.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 (143) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/adagioBidAdapter.js +1 -1
  3. package/dist/adbookpspBidAdapter.js +1 -1
  4. package/dist/adgenerationBidAdapter.js +1 -1
  5. package/dist/adpod.js +1 -1
  6. package/dist/adrelevantisBidAdapter.js +1 -1
  7. package/dist/adxcgBidAdapter.js +1 -1
  8. package/dist/ajaBidAdapter.js +1 -1
  9. package/dist/amxBidAdapter.js +1 -1
  10. package/dist/amxIdSystem.js +1 -1
  11. package/dist/appierAnalyticsAdapter.js +1 -1
  12. package/dist/appnexusBidAdapter.js +1 -1
  13. package/dist/asoBidAdapter.js +1 -1
  14. package/dist/axonixBidAdapter.js +1 -1
  15. package/dist/bidglassBidAdapter.js +1 -1
  16. package/dist/big-richmediaBidAdapter.js +1 -1
  17. package/dist/bridgewellBidAdapter.js +1 -1
  18. package/dist/brightMountainMediaBidAdapter.js +1 -1
  19. package/dist/concertBidAdapter.js +1 -1
  20. package/dist/connectadBidAdapter.js +1 -1
  21. package/dist/consumableBidAdapter.js +1 -1
  22. package/dist/conversantBidAdapter.js +1 -1
  23. package/dist/craftBidAdapter.js +1 -1
  24. package/dist/criteoBidAdapter.js +1 -1
  25. package/dist/debugging-standalone.js +1 -1
  26. package/dist/debugging.js +1 -1
  27. package/dist/dspxBidAdapter.js +1 -1
  28. package/dist/eplanningBidAdapter.js +1 -1
  29. package/dist/finativeBidAdapter.js +1 -1
  30. package/dist/glimpseBidAdapter.js +1 -1
  31. package/dist/gmosspBidAdapter.js +1 -1
  32. package/dist/goldbachBidAdapter.js +1 -1
  33. package/dist/gridBidAdapter.js +1 -1
  34. package/dist/gridNMBidAdapter.js +1 -1
  35. package/dist/gumgumBidAdapter.js +1 -1
  36. package/dist/h12mediaBidAdapter.js +1 -1
  37. package/dist/id5IdSystem.js +1 -1
  38. package/dist/improvedigitalBidAdapter.js +1 -1
  39. package/dist/inmarBidAdapter.js +1 -1
  40. package/dist/insticatorBidAdapter.js +1 -1
  41. package/dist/ixBidAdapter.js +1 -1
  42. package/dist/justpremiumBidAdapter.js +1 -1
  43. package/dist/kargoBidAdapter.js +1 -1
  44. package/dist/konduitAnalyticsAdapter.js +1 -1
  45. package/dist/kueezBidAdapter.js +1 -1
  46. package/dist/lassoBidAdapter.js +1 -1
  47. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  48. package/dist/logicadBidAdapter.js +1 -1
  49. package/dist/loglyliftBidAdapter.js +1 -1
  50. package/dist/malltvAnalyticsAdapter.js +1 -1
  51. package/dist/marsmediaBidAdapter.js +1 -1
  52. package/dist/mediafuseBidAdapter.js +1 -1
  53. package/dist/mediasquareBidAdapter.js +1 -1
  54. package/dist/mgidBidAdapter.js +1 -1
  55. package/dist/minutemediaBidAdapter.js +1 -1
  56. package/dist/missenaBidAdapter.js +1 -1
  57. package/dist/not-for-prod/prebid.js +112 -110
  58. package/dist/oguryBidAdapter.js +1 -1
  59. package/dist/onetagBidAdapter.js +1 -1
  60. package/dist/ooloAnalyticsAdapter.js +1 -1
  61. package/dist/openxOrtbBidAdapter.js +1 -0
  62. package/dist/outbrainBidAdapter.js +1 -1
  63. package/dist/parrableIdSystem.js +1 -1
  64. package/dist/pixfutureBidAdapter.js +1 -1
  65. package/dist/prebid-core.js +2 -2
  66. package/dist/publinkIdSystem.js +1 -1
  67. package/dist/pubmaticBidAdapter.js +1 -1
  68. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  69. package/dist/pxyzBidAdapter.js +1 -1
  70. package/dist/quantcastBidAdapter.js +1 -1
  71. package/dist/readpeakBidAdapter.js +1 -1
  72. package/dist/relaidoBidAdapter.js +1 -1
  73. package/dist/rhythmoneBidAdapter.js +1 -1
  74. package/dist/riseBidAdapter.js +1 -1
  75. package/dist/rubiconAnalyticsAdapter.js +1 -1
  76. package/dist/rubiconBidAdapter.js +1 -1
  77. package/dist/seedingAllianceBidAdapter.js +1 -1
  78. package/dist/seedtagBidAdapter.js +1 -1
  79. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  80. package/dist/sharethroughBidAdapter.js +1 -1
  81. package/dist/shinezBidAdapter.js +1 -0
  82. package/dist/sizeMappingV2.js +1 -1
  83. package/dist/smaatoBidAdapter.js +1 -1
  84. package/dist/smartadserverBidAdapter.js +1 -1
  85. package/dist/smartxBidAdapter.js +1 -1
  86. package/dist/smilewantedBidAdapter.js +1 -1
  87. package/dist/sonobiBidAdapter.js +1 -1
  88. package/dist/sovrnAnalyticsAdapter.js +1 -1
  89. package/dist/sovrnBidAdapter.js +1 -1
  90. package/dist/sspBCBidAdapter.js +1 -1
  91. package/dist/sublimeBidAdapter.js +1 -1
  92. package/dist/synacormediaBidAdapter.js +1 -1
  93. package/dist/targetVideoBidAdapter.js +1 -1
  94. package/dist/teadsBidAdapter.js +1 -1
  95. package/dist/trionBidAdapter.js +1 -1
  96. package/dist/tripleliftBidAdapter.js +1 -1
  97. package/dist/ttdBidAdapter.js +1 -1
  98. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  99. package/dist/underdogmediaBidAdapter.js +1 -1
  100. package/dist/undertoneBidAdapter.js +1 -1
  101. package/dist/ventesBidAdapter.js +1 -1
  102. package/dist/vidazooBidAdapter.js +1 -1
  103. package/dist/videobyteBidAdapter.js +1 -1
  104. package/dist/visxBidAdapter.js +1 -1
  105. package/dist/vrtcalBidAdapter.js +1 -1
  106. package/dist/vuukleBidAdapter.js +1 -1
  107. package/dist/widespaceBidAdapter.js +1 -1
  108. package/dist/winrBidAdapter.js +1 -1
  109. package/dist/yahoosspBidAdapter.js +1 -1
  110. package/dist/yieldmoBidAdapter.js +1 -1
  111. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  112. package/gulpfile.js +1 -1
  113. package/modules/debugging/bidInterceptor.js +1 -1
  114. package/modules/debugging/index.js +2 -1
  115. package/modules/insticatorBidAdapter.js +9 -0
  116. package/modules/ixBidAdapter.js +389 -48
  117. package/modules/ixBidAdapter.md +95 -5
  118. package/modules/kargoBidAdapter.js +1 -2
  119. package/modules/missenaBidAdapter.js +20 -2
  120. package/modules/openxBidAdapter.md +3 -1
  121. package/modules/openxOrtbBidAdapter.js +349 -0
  122. package/modules/openxOrtbBidAdapter.md +105 -0
  123. package/modules/readpeakBidAdapter.js +15 -6
  124. package/modules/relaidoBidAdapter.js +19 -4
  125. package/modules/shinezBidAdapter.js +435 -0
  126. package/modules/shinezBidAdapter.md +76 -0
  127. package/modules/ventesBidAdapter.js +1 -1
  128. package/modules/ventesBidAdapter.md +1 -1
  129. package/modules/vrtcalBidAdapter.js +35 -0
  130. package/package.json +1 -1
  131. package/plugins/pbjsGlobals.js +2 -1
  132. package/test/spec/modules/debugging_mod_spec.js +7 -0
  133. package/test/spec/modules/insticatorBidAdapter_spec.js +22 -1
  134. package/test/spec/modules/ixBidAdapter_spec.js +333 -5
  135. package/test/spec/modules/kargoBidAdapter_spec.js +1 -0
  136. package/test/spec/modules/missenaBidAdapter_spec.js +36 -14
  137. package/test/spec/modules/openxOrtbBidAdapter_spec.js +1303 -0
  138. package/test/spec/modules/readpeakBidAdapter_spec.js +1 -0
  139. package/test/spec/modules/relaidoBidAdapter_spec.js +29 -2
  140. package/test/spec/modules/shinezBidAdapter_spec.js +479 -0
  141. package/test/spec/modules/ventesBidAdapter_spec.js +2 -2
  142. package/test/spec/modules/vrtcalBidAdapter_spec.js +17 -0
  143. package/webpack.conf.js +1 -1
@@ -35,6 +35,7 @@ describe('InsticatorBidAdapter', function () {
35
35
  ],
36
36
  w: 250,
37
37
  h: 300,
38
+ placement: 2,
38
39
  },
39
40
  },
40
41
  bidId: '30b31c1838de1e',
@@ -155,6 +156,25 @@ describe('InsticatorBidAdapter', function () {
155
156
  }
156
157
  })).to.be.false;
157
158
  });
159
+
160
+ it('should return false if video placement is not a number', () => {
161
+ expect(spec.isBidRequestValid({
162
+ ...bidRequest,
163
+ ...{
164
+ mediaTypes: {
165
+ video: {
166
+ mimes: [
167
+ 'video/mp4',
168
+ 'video/mpeg',
169
+ ],
170
+ w: 250,
171
+ h: 300,
172
+ placement: 'NaN',
173
+ },
174
+ }
175
+ }
176
+ })).to.be.false;
177
+ });
158
178
  });
159
179
 
160
180
  describe('buildRequests', function () {
@@ -276,7 +296,7 @@ describe('InsticatorBidAdapter', function () {
276
296
  banner: {
277
297
  format: [
278
298
  { w: 300, h: 250 },
279
- { w: 300, h: 600 },
299
+ { w: 300, h: 600 }
280
300
  ]
281
301
  },
282
302
  video: {
@@ -286,6 +306,7 @@ describe('InsticatorBidAdapter', function () {
286
306
  ],
287
307
  h: 300,
288
308
  w: 250,
309
+ placement: 2,
289
310
  },
290
311
  ext: {
291
312
  gpid: bidRequest.ortb2Imp.ext.gpid,
@@ -4,12 +4,13 @@ import { expect } from 'chai';
4
4
  import { newBidder } from 'src/adapters/bidderFactory.js';
5
5
  import { spec, storage, ERROR_CODES } from '../../../modules/ixBidAdapter.js';
6
6
  import { createEidsArray } from 'modules/userId/eids.js';
7
- import { deepAccess } from '../../../src/utils.js';
7
+ import { deepAccess, deepClone } from '../../../src/utils.js';
8
8
 
9
9
  describe('IndexexchangeAdapter', function () {
10
10
  const IX_SECURE_ENDPOINT = 'https://htlb.casalemedia.com/openrtb/pbjs';
11
11
  const VIDEO_ENDPOINT_VERSION = 8.1;
12
12
  const BANNER_ENDPOINT_VERSION = 7.2;
13
+ const NATIVE_ENDPOINT_VERSION = undefined;
13
14
 
14
15
  const SAMPLE_SCHAIN = {
15
16
  'ver': '1.0',
@@ -315,6 +316,88 @@ describe('IndexexchangeAdapter', function () {
315
316
  }
316
317
  ];
317
318
 
319
+ const DEFAULT_NATIVE_VALID_BID = [
320
+ {
321
+ bidder: 'ix',
322
+ params: {
323
+ siteId: '123',
324
+ size: [300, 250]
325
+ },
326
+ sizes: [[300, 250], [300, 600]],
327
+ mediaTypes: {
328
+ native: {
329
+ icon: {
330
+ required: false
331
+ },
332
+ title: {
333
+ required: true
334
+ },
335
+ body: {
336
+ required: true
337
+ },
338
+ image: {
339
+ required: true
340
+ },
341
+ video: {
342
+ required: false
343
+ },
344
+ sponsoredBy: {
345
+ required: true
346
+ }
347
+ }
348
+ },
349
+ adUnitCode: 'div-gpt-ad-1460505748563-0',
350
+ transactionId: '173f49a8-7549-4218-a23c-e7ba59b47231',
351
+ bidId: '1a2b3c4f',
352
+ bidderRequestId: '11a22b33c44f',
353
+ auctionId: '1aa2bb3cc4df',
354
+ schain: SAMPLE_SCHAIN
355
+ }
356
+ ];
357
+
358
+ const DEFAULT_MULTIFORMAT_NATIVE_VALID_BID = [
359
+ {
360
+ bidder: 'ix',
361
+ params: {
362
+ siteId: '123',
363
+ size: [300, 250],
364
+ },
365
+ mediaTypes: {
366
+ banner: {
367
+ sizes: [[300, 250], [300, 600], [400, 500]]
368
+ },
369
+ native: {
370
+ title: {
371
+ required: true
372
+ },
373
+ body: {
374
+ required: true
375
+ },
376
+ image: {
377
+ required: true
378
+ },
379
+ sponsoredBy: {
380
+ required: true
381
+ },
382
+ icon: {
383
+ required: false
384
+ }
385
+ }
386
+ },
387
+ adUnitCode: 'div-gpt-ad-1460505748562-0',
388
+ transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230',
389
+ bidId: '1a2b3c4e',
390
+ bidderRequestId: '11a22b33c44e',
391
+ auctionId: '1aa2bb3cc4de',
392
+ schain: SAMPLE_SCHAIN
393
+ }
394
+ ];
395
+
396
+ const DEFAULT_NATIVE_IMP = {
397
+ request: '{"assets":[{"required":0,"img":{"type":1},"id":201},{"required":1,"title":{"len":25},"id":100},{"required":1,"data":{"type":2},"id":402},{"required":1,"img":{"type":3},"id":203},{"required":0,"video":{"mimes":["video/mp4","video/webm"],"minduration":0,"maxduration":120,"protocols":[2,3,5,6]},"id":300},{"required":1,"data":{"type":1},"id":401}],"ver":"1.2","eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}',
398
+ ver: '1.2'
399
+ }
400
+
318
401
  const DEFAULT_BANNER_BID_RESPONSE = {
319
402
  cur: 'USD',
320
403
  id: '11a22b33c44d',
@@ -437,6 +520,34 @@ describe('IndexexchangeAdapter', function () {
437
520
  ]
438
521
  };
439
522
 
523
+ const DEFAULT_NATIVE_BID_RESPONSE = {
524
+ cur: 'USD',
525
+ id: '11a22b33c44d',
526
+ seatbid: [
527
+ {
528
+ bid: [
529
+ {
530
+ crid: '12345',
531
+ adomain: ['www.abc.com'],
532
+ adid: '14851455',
533
+ impid: '1a2b3c4d',
534
+ cid: '3051266',
535
+ price: 100,
536
+ id: '1',
537
+ ext: {
538
+ dspid: 50,
539
+ pricelevel: '_100',
540
+ advbrandid: 303325,
541
+ advbrand: 'OECTA'
542
+ },
543
+ adm: '{"native":{"ver":"1.2","assets":[{"id":201,"img":{"url":"https://cdn.liftoff.io/customers/1209/creatives/2501-icon-250x250.png","w":250,"h":250}},{"id":203,"img":{"url":"https://cdn.liftoff.io/customers/5a9cab9cc6/image/lambda_png/a0355879b06c09b09232.png","w":1200,"h":627}},{"id":401,"data":{"value":"autodoc.co.uk"}},{"id":402,"data":{"value":"Les pièces automobiles dont vous avez besoin, toujours sous la main."}},{"id":100,"title":{"text":"Autodoc"}},{"id":300,"video":{"vasttag":"<VAST>blah</VAST>"}}],"link":{"url":"https://play.google.com/store/apps/details?id=de.autodoc.gmbh","clicktrackers":["https://click.liftoff.io/v1/campaign_click/blah"]},"eventtrackers":[{"event":1,"method":1,"url":"https://impression-europe.liftoff.io/index/impression"},{"event":1,"method":1,"url":"https://a701.casalemedia.com/impression/v1"}],"privacy":"https://privacy.link.com"}}'
544
+ }
545
+ ],
546
+ seat: '3970'
547
+ }
548
+ ]
549
+ };
550
+
440
551
  const DEFAULT_OPTION = {
441
552
  gdprConsent: {
442
553
  gdprApplies: true,
@@ -617,6 +728,7 @@ describe('IndexexchangeAdapter', function () {
617
728
  it('should return true when required params found for a banner or video ad', function () {
618
729
  expect(spec.isBidRequestValid(DEFAULT_BANNER_VALID_BID[0])).to.equal(true);
619
730
  expect(spec.isBidRequestValid(DEFAULT_VIDEO_VALID_BID[0])).to.equal(true);
731
+ expect(spec.isBidRequestValid(DEFAULT_NATIVE_VALID_BID[0])).to.equal(true);
620
732
  });
621
733
 
622
734
  it('should return true when optional bidFloor params found for an ad', function () {
@@ -705,11 +817,11 @@ describe('IndexexchangeAdapter', function () {
705
817
  });
706
818
 
707
819
  it('should return false when mediaType is native', function () {
708
- const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
820
+ const bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID[0]);
709
821
  delete bid.params.mediaTypes;
710
822
  bid.mediaType = 'native';
711
823
  bid.sizes = [[300, 250]];
712
- expect(spec.isBidRequestValid(bid)).to.equal(false);
824
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
713
825
  });
714
826
 
715
827
  it('should return true when mediaType is missing and has sizes', function () {
@@ -745,6 +857,11 @@ describe('IndexexchangeAdapter', function () {
745
857
  expect(spec.isBidRequestValid(bid)).to.equal(true);
746
858
  });
747
859
 
860
+ it('shoult return true for native bid when there are multiple mediaTypes (banner, native)', function () {
861
+ const bid = utils.deepClone(DEFAULT_MULTIFORMAT_NATIVE_VALID_BID[0]);
862
+ expect(spec.isBidRequestValid(bid)).to.be.true;
863
+ });
864
+
748
865
  it('should return false when there is only bidFloor', function () {
749
866
  const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
750
867
  bid.params.bidFloor = 50;
@@ -807,6 +924,18 @@ describe('IndexexchangeAdapter', function () {
807
924
  delete bid.params.video.protocols;
808
925
  expect(spec.isBidRequestValid(bid)).to.equal(false);
809
926
  });
927
+
928
+ it('should fail when native contains unrecongized properties', function () {
929
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID[0]);
930
+ bid.mediaTypes.native.test = {}
931
+ expect(spec.isBidRequestValid(bid)).to.be.false;
932
+ });
933
+
934
+ it('should fail if native mediaTypes should contains no valid assets', function () {
935
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID[0]);
936
+ bid.mediaTypes.native = {}
937
+ expect(spec.isBidRequestValid(bid)).to.be.false;
938
+ });
810
939
  });
811
940
 
812
941
  describe('Roundel alias adapter', function () {
@@ -1785,6 +1914,39 @@ describe('IndexexchangeAdapter', function () {
1785
1914
  });
1786
1915
  });
1787
1916
 
1917
+ describe('request should contain both banner and native requests', function () {
1918
+ const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_NATIVE_VALID_BID[0]]);
1919
+
1920
+ it('should have banner request', () => {
1921
+ const bannerImpression = JSON.parse(request[0].data.r).imp[0];
1922
+
1923
+ expect(JSON.parse(request[0].data.r).imp).to.have.lengthOf(1);
1924
+ expect(JSON.parse(request[0].data.v)).to.equal(BANNER_ENDPOINT_VERSION);
1925
+ expect(bannerImpression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
1926
+
1927
+ expect(bannerImpression.banner.format).to.be.length(2);
1928
+ expect(bannerImpression.banner.topframe).to.be.oneOf([0, 1]);
1929
+
1930
+ bannerImpression.banner.format.map(({ w, h, ext }, index) => {
1931
+ const size = DEFAULT_BANNER_VALID_BID[0].mediaTypes.banner.sizes[index];
1932
+ const sidValue = utils.parseGPTSingleSizeArray(size);
1933
+
1934
+ expect(w).to.equal(size[0]);
1935
+ expect(h).to.equal(size[1]);
1936
+ expect(ext.siteID).to.equal(DEFAULT_BANNER_VALID_BID[0].params.siteId);
1937
+ expect(ext.sid).to.equal(sidValue);
1938
+ });
1939
+ });
1940
+
1941
+ it('should have native request', () => {
1942
+ const nativeImpression = JSON.parse(request[1].data.r).imp[0];
1943
+
1944
+ expect(request[1].data.v).to.equal(NATIVE_ENDPOINT_VERSION);
1945
+ expect(nativeImpression.id).to.equal(DEFAULT_NATIVE_VALID_BID[0].bidId);
1946
+ expect(nativeImpression.native).to.deep.equal(DEFAULT_NATIVE_IMP);
1947
+ });
1948
+ });
1949
+
1788
1950
  it('single request under 8k size limit for large ad unit', function () {
1789
1951
  const options = {};
1790
1952
  const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
@@ -2120,6 +2282,125 @@ describe('IndexexchangeAdapter', function () {
2120
2282
  })
2121
2283
  });
2122
2284
 
2285
+ describe('buildRequestNative', function () {
2286
+ it('should build request with expected params', function() {
2287
+ const request = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION);
2288
+ const query = request[0].data;
2289
+
2290
+ expect(query.v).to.equal(NATIVE_ENDPOINT_VERSION);
2291
+ expect(query.s).to.equal(DEFAULT_NATIVE_VALID_BID[0].params.siteId);
2292
+ expect(query.r).to.exist;
2293
+ expect(query.ac).to.equal('j');
2294
+ expect(query.sd).to.equal(1);
2295
+ expect(JSON.parse(query.r).at).to.equal(1);
2296
+ });
2297
+
2298
+ it('should send gpid in request if ortb2Imp.ext.gpid exists', function () {
2299
+ const GPID = '/19968336/some-adunit-path';
2300
+ const bids = utils.deepClone(DEFAULT_NATIVE_VALID_BID);
2301
+ bids[0].ortb2Imp = {
2302
+ ext: {
2303
+ gpid: GPID
2304
+ }
2305
+ };
2306
+ const requests = spec.buildRequests(bids, DEFAULT_OPTION);
2307
+ const { ext: { gpid } } = JSON.parse(requests[0].data.r).imp[0];
2308
+ expect(gpid).to.equal(GPID);
2309
+ });
2310
+
2311
+ it('should build request with required asset properties with default values', function() {
2312
+ const request = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION);
2313
+ const nativeImpression = JSON.parse(request[0].data.r).imp[0];
2314
+
2315
+ expect(request[0].data.v).to.equal(NATIVE_ENDPOINT_VERSION);
2316
+ expect(nativeImpression.id).to.equal(DEFAULT_NATIVE_VALID_BID[0].bidId);
2317
+ expect(nativeImpression.native).to.deep.equal(DEFAULT_NATIVE_IMP);
2318
+ });
2319
+
2320
+ it('should build request with given asset properties', function() {
2321
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID)
2322
+ bid[0].mediaTypes.native = {
2323
+ title: {
2324
+ len: 200
2325
+ },
2326
+ video: {
2327
+ mimes: [
2328
+ 'javascript'
2329
+ ],
2330
+ minduration: 10,
2331
+ maxduration: 60,
2332
+ protocols: [1]
2333
+ }
2334
+ }
2335
+ const request = spec.buildRequests(bid, DEFAULT_OPTION);
2336
+ const nativeImpression = JSON.parse(request[0].data.r).imp[0];
2337
+ expect(nativeImpression.native).to.deep.equal({request: '{"assets":[{"required":0,"title":{"len":200},"id":100},{"required":0,"video":{"mimes":["javascript"],"minduration":10,"maxduration":60,"protocols":[1]},"id":300}],"ver":"1.2","eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2'});
2338
+ });
2339
+
2340
+ it('should build request with all possible Prebid asset properties', function() {
2341
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID)
2342
+ bid[0].mediaTypes.native = {
2343
+ title: {
2344
+ required: false
2345
+ },
2346
+ body: {
2347
+ required: false
2348
+ },
2349
+ body2: {
2350
+ required: false
2351
+ },
2352
+ sponsoredBy: {
2353
+ required: false
2354
+ },
2355
+ icon: {
2356
+ required: false
2357
+ },
2358
+ image: {
2359
+ required: false
2360
+ },
2361
+ clickUrl: {
2362
+ required: false
2363
+ },
2364
+ displayUrl: {
2365
+ required: false
2366
+ },
2367
+ privacyLink: {
2368
+ required: false
2369
+ },
2370
+ privacyIcon: {
2371
+ required: false
2372
+ },
2373
+ cta: {
2374
+ required: false
2375
+ },
2376
+ rating: {
2377
+ required: false
2378
+ },
2379
+ downloads: {
2380
+ required: false
2381
+ },
2382
+ likes: {
2383
+ required: false
2384
+ },
2385
+ price: {
2386
+ required: false
2387
+ },
2388
+ salePrice: {
2389
+ required: false
2390
+ },
2391
+ address: {
2392
+ required: false
2393
+ },
2394
+ phone: {
2395
+ required: false
2396
+ },
2397
+ }
2398
+ const request = spec.buildRequests(bid, DEFAULT_OPTION);
2399
+ const nativeImpression = JSON.parse(request[0].data.r).imp[0];
2400
+ expect(nativeImpression.native).to.deep.equal({request: '{"assets":[{"required":0,"title":{"len":25},"id":100},{"required":0,"data":{"type":2},"id":402},{"required":0,"data":{"type":10},"id":410},{"required":0,"data":{"type":1},"id":401},{"required":0,"img":{"type":1},"id":201},{"required":0,"img":{"type":3},"id":203},{"required":0,"data":{"type":11},"id":411},{"required":0,"data":{"type":12},"id":412},{"required":0,"data":{"type":3},"id":403},{"required":0,"data":{"type":5},"id":405},{"required":0,"data":{"type":4},"id":404},{"required":0,"data":{"type":6},"id":406},{"required":0,"data":{"type":7},"id":407},{"required":0,"data":{"type":9},"id":409},{"required":0,"data":{"type":8},"id":408}],"ver":"1.2","eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2'});
2401
+ })
2402
+ });
2403
+
2123
2404
  describe('buildRequestMultiFormat', function () {
2124
2405
  it('only banner bidder params set', function () {
2125
2406
  const request = spec.buildRequests(DEFAULT_MULTIFORMAT_BANNER_VALID_BID, {})
@@ -2584,6 +2865,53 @@ describe('IndexexchangeAdapter', function () {
2584
2865
  expect(bannerResult[0].ttl).to.equal(300);
2585
2866
  expect(videoResult[0].ttl).to.equal(3600);
2586
2867
  });
2868
+
2869
+ it('should get correct bid response for native ad', function () {
2870
+ const expectedParse = [
2871
+ {
2872
+ requestId: '1a2b3c4d',
2873
+ cpm: 1,
2874
+ creativeId: '12345',
2875
+ mediaType: 'native',
2876
+ width: 1,
2877
+ height: 1,
2878
+ currency: 'USD',
2879
+ netRevenue: true,
2880
+ meta: {
2881
+ networkId: 50,
2882
+ brandId: 303325,
2883
+ brandName: 'OECTA',
2884
+ advertiserDomains: ['www.abc.com']
2885
+ },
2886
+ native: {
2887
+ body: 'Les pièces automobiles dont vous avez besoin, toujours sous la main.',
2888
+ clickUrl: 'https://play.google.com/store/apps/details?id=de.autodoc.gmbh',
2889
+ icon: {
2890
+ height: 250,
2891
+ width: 250,
2892
+ url: 'https://cdn.liftoff.io/customers/1209/creatives/2501-icon-250x250.png'
2893
+ },
2894
+ image: {
2895
+ height: 627,
2896
+ width: 1200,
2897
+ url: 'https://cdn.liftoff.io/customers/5a9cab9cc6/image/lambda_png/a0355879b06c09b09232.png'
2898
+ },
2899
+ impressionTrackers: [
2900
+ 'https://click.liftoff.io/v1/campaign_click/blah',
2901
+ 'https://impression-europe.liftoff.io/index/impression',
2902
+ 'https://a701.casalemedia.com/impression/v1'
2903
+ ],
2904
+ privacyLink: 'https://privacy.link.com',
2905
+ sponsoredBy: 'autodoc.co.uk',
2906
+ title: 'Autodoc',
2907
+ video: '<VAST>blah</VAST>'
2908
+ },
2909
+ ttl: 3600
2910
+ }
2911
+ ];
2912
+ const result = spec.interpretResponse({ body: DEFAULT_NATIVE_BID_RESPONSE }, { data: DEFAULT_BIDDER_REQUEST_DATA, validBidRequests: [] });
2913
+ expect(result[0]).to.deep.equal(expectedParse[0]);
2914
+ });
2587
2915
  });
2588
2916
 
2589
2917
  describe('bidrequest consent', function () {
@@ -2839,8 +3167,8 @@ describe('IndexexchangeAdapter', function () {
2839
3167
  bid.params.video.maxduration = 0;
2840
3168
 
2841
3169
  expect(spec.isBidRequestValid(bid)).to.be.true;
2842
- spec.buildRequests([bid], {});
2843
- expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.VIDEO_DURATION_INVALID]: 3 } });
3170
+ spec.buildRequests([bid]);
3171
+ expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.VIDEO_DURATION_INVALID]: 2 } });
2844
3172
  });
2845
3173
 
2846
3174
  it('should increment errors for errorCode', () => {
@@ -572,6 +572,7 @@ describe('kargo adapter tests', function () {
572
572
  cpm: 2.5,
573
573
  width: 300,
574
574
  height: 250,
575
+ ad: '<VAST></VAST>',
575
576
  vastXml: '<VAST></VAST>',
576
577
  ttl: 300,
577
578
  creativeId: 'bar',
@@ -133,25 +133,47 @@ describe('Missena Adapter', function () {
133
133
  });
134
134
 
135
135
  describe('getUserSyncs', function () {
136
- const expectedUserSyncs = [
137
- { type: 'iframe', url: 'https://sync.missena.io/iframe' },
138
- ];
139
- const serverResponses = [];
136
+ const syncFrameUrl = 'https://sync.missena.io/iframe';
137
+ const consentString = 'sampleString';
138
+ const iframeEnabledOptions = {
139
+ iframeEnabled: true,
140
+ };
141
+ const iframeDisabledOptions = {
142
+ iframeEnabled: false,
143
+ };
140
144
 
141
145
  it('should return userSync when iframeEnabled', function () {
142
- const syncOptions = {
143
- iframeEnabled: true,
144
- };
145
- const userSyncs = spec.getUserSyncs(syncOptions, serverResponses);
146
- expect(userSyncs).to.deep.equal(expectedUserSyncs);
146
+ const userSync = spec.getUserSyncs(iframeEnabledOptions, []);
147
+
148
+ expect(userSync.length).to.be.equal(1);
149
+ expect(userSync[0].type).to.be.equal('iframe');
150
+ expect(userSync[0].url).to.be.equal(syncFrameUrl);
147
151
  });
148
152
 
149
153
  it('should return empty array when iframeEnabled is false', function () {
150
- const syncOptions = {
151
- iframeEnabled: false,
152
- };
153
- const userSyncs = spec.getUserSyncs(syncOptions, serverResponses);
154
- expect(userSyncs).to.deep.equal([]);
154
+ const userSync = spec.getUserSyncs(iframeDisabledOptions, []);
155
+ expect(userSync.length).to.be.equal(0);
156
+ });
157
+
158
+ it('sync frame url should contain gdpr data when present', function () {
159
+ const userSync = spec.getUserSyncs(iframeEnabledOptions, [], {
160
+ gdprApplies: true,
161
+ consentString,
162
+ });
163
+ const expectedUrl = `${syncFrameUrl}?gdpr=1&gdpr_consent=${consentString}`;
164
+ expect(userSync.length).to.be.equal(1);
165
+ expect(userSync[0].type).to.be.equal('iframe');
166
+ expect(userSync[0].url).to.be.equal(expectedUrl);
167
+ });
168
+ it('sync frame url should contain gdpr data when present (gdprApplies false)', function () {
169
+ const userSync = spec.getUserSyncs(iframeEnabledOptions, [], {
170
+ gdprApplies: false,
171
+ consentString,
172
+ });
173
+ const expectedUrl = `${syncFrameUrl}?gdpr=0&gdpr_consent=${consentString}`;
174
+ expect(userSync.length).to.be.equal(1);
175
+ expect(userSync[0].type).to.be.equal('iframe');
176
+ expect(userSync[0].url).to.be.equal(expectedUrl);
155
177
  });
156
178
  });
157
179
  });