@@ -18,15 +18,12 @@ import {
18
18
} from '../src/utils.js' ;
19
19
import { BANNER , VIDEO , NATIVE } from '../src/mediaTypes.js' ;
20
20
import { config } from '../src/config.js' ;
21
- import { EVENTS } from '../src/constants.js' ;
22
21
import { getStorageManager } from '../src/storageManager.js' ;
23
- import * as events from '../src/events.js' ;
24
22
import { find } from '../src/polyfill.js' ;
25
23
import { registerBidder } from '../src/adapters/bidderFactory.js' ;
26
24
import { INSTREAM , OUTSTREAM } from '../src/video.js' ;
27
25
import { Renderer } from '../src/Renderer.js' ;
28
26
import { getGptSlotInfoForAdUnitCode } from '../libraries/gptUtils/gptUtils.js' ;
29
- import { convertTypes } from '../libraries/transformParamsUtils/convertTypes.js' ;
30
27
31
28
const BIDDER_CODE = 'ix' ;
32
29
const ALIAS_BIDDER_CODE = 'roundel' ;
@@ -49,17 +46,6 @@ const PRICE_TO_DOLLAR_FACTOR = {
49
46
const IFRAME_USER_SYNC_URL = 'https://js-sec.indexww.com/um/ixmatch.html' ;
50
47
const FLOOR_SOURCE = { PBJS : 'p' , IX : 'x' } ;
51
48
const IMG_USER_SYNC_URL = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid' ;
52
- export const ERROR_CODES = {
53
- BID_SIZE_INVALID_FORMAT : 1 ,
54
- BID_SIZE_NOT_INCLUDED : 2 ,
55
- PROPERTY_NOT_INCLUDED : 3 ,
56
- SITE_ID_INVALID_VALUE : 4 ,
57
- BID_FLOOR_INVALID_FORMAT : 5 ,
58
- IX_FPD_EXCEEDS_MAX_SIZE : 6 ,
59
- EXCEEDS_MAX_SIZE : 7 ,
60
- PB_FPD_EXCEEDS_MAX_SIZE : 8 ,
61
- VIDEO_DURATION_INVALID : 9
62
- } ;
63
49
const FIRST_PARTY_DATA = {
64
50
SITE : [
65
51
'id' , 'name' , 'domain' , 'cat' , 'sectioncat' , 'pagecat' , 'page' , 'ref' , 'search' , 'mobile' ,
@@ -110,7 +96,6 @@ const VIDEO_PARAMS_ALLOW_LIST = [
110
96
] ;
111
97
const LOCAL_STORAGE_KEY = 'ixdiag' ;
112
98
export const LOCAL_STORAGE_FEATURE_TOGGLES_KEY = `${ BIDDER_CODE } _features` ;
113
- let hasRegisteredHandler = false ;
114
99
export const storage = getStorageManager ( { bidderCode : BIDDER_CODE } ) ;
115
100
export const FEATURE_TOGGLES = {
116
101
// Update with list of CFTs to be requested from Exchange
@@ -262,8 +247,7 @@ export function bidToVideoImp(bid) {
262
247
263
248
if ( imp . video . minduration > imp . video . maxduration ) {
264
249
logError (
265
- `IX Bid Adapter: video minduration [${ imp . video . minduration } ] cannot be greater than video maxduration [${ imp . video . maxduration } ]` ,
266
- { bidder : BIDDER_CODE , code : ERROR_CODES . VIDEO_DURATION_INVALID }
250
+ `IX Bid Adapter: video minduration [${ imp . video . minduration } ] cannot be greater than video maxduration [${ imp . video . maxduration } ]`
267
251
) ;
268
252
return { } ;
269
253
}
@@ -883,13 +867,6 @@ function enrichRequest(r, bidderRequest, impressions, validBidRequests, userEids
883
867
r . ext . ixdiag . syncsPerBidder = config . getConfig ( 'userSync' ) . syncsPerBidder ;
884
868
}
885
869
886
- // Get cached errors stored in LocalStorage
887
- const cachedErrors = getCachedErrors ( ) ;
888
-
889
- if ( ! isEmpty ( cachedErrors ) ) {
890
- r . ext . ixdiag . err = cachedErrors ;
891
- }
892
-
893
870
// Add number of available imps to ixDiag.
894
871
r . ext . ixdiag . imps = Object . keys ( impressions ) . length ;
895
872
@@ -1546,104 +1523,6 @@ function createMissingBannerImp(bid, imp, newSize) {
1546
1523
return newImp ;
1547
1524
}
1548
1525
1549
- /**
1550
- * @typedef {Array[message: string, err: Object<bidder: string, code: number>] } ErrorData
1551
- * @property {string } message - The error message.
1552
- * @property {object } err - The error object.
1553
- * @property {string } err.bidder - The bidder of the error.
1554
- * @property {string } err.code - The error code.
1555
- */
1556
-
1557
- /**
1558
- * Error Event handler that receives type and arguments in a data object.
1559
- *
1560
- * @param {ErrorData } data
1561
- */
1562
- function storeErrorEventData ( data ) {
1563
- if ( ! storage . localStorageIsEnabled ( ) ) {
1564
- return ;
1565
- }
1566
-
1567
- let currentStorage ;
1568
-
1569
- try {
1570
- currentStorage = JSON . parse ( storage . getDataFromLocalStorage ( LOCAL_STORAGE_KEY ) || '{}' ) ;
1571
- } catch ( e ) {
1572
- logWarn ( 'ix can not read ixdiag from localStorage.' ) ;
1573
- }
1574
-
1575
- const todayDate = new Date ( ) ;
1576
-
1577
- Object . keys ( currentStorage ) . map ( ( errorDate ) => {
1578
- const date = new Date ( errorDate ) ;
1579
-
1580
- if ( date . setDate ( date . getDate ( ) + 7 ) - todayDate < 0 ) {
1581
- delete currentStorage [ errorDate ] ;
1582
- }
1583
- } ) ;
1584
-
1585
- if ( data . type === 'ERROR' && data . arguments && data . arguments [ 1 ] && data . arguments [ 1 ] . bidder === BIDDER_CODE ) {
1586
- const todayString = todayDate . toISOString ( ) . slice ( 0 , 10 ) ;
1587
-
1588
- const errorCode = data . arguments [ 1 ] . code ;
1589
-
1590
- if ( errorCode ) {
1591
- currentStorage [ todayString ] = currentStorage [ todayString ] || { } ;
1592
-
1593
- if ( ! Number ( currentStorage [ todayString ] [ errorCode ] ) ) {
1594
- currentStorage [ todayString ] [ errorCode ] = 0 ;
1595
- }
1596
-
1597
- currentStorage [ todayString ] [ errorCode ] ++ ;
1598
- } ;
1599
- }
1600
-
1601
- storage . setDataInLocalStorage ( LOCAL_STORAGE_KEY , JSON . stringify ( currentStorage ) ) ;
1602
- }
1603
-
1604
- /**
1605
- * Event handler for storing data into local storage. It will only store data if
1606
- * local storage premissions are avaliable
1607
- */
1608
- function localStorageHandler ( data ) {
1609
- if ( data . type === 'ERROR' && data . arguments && data . arguments [ 1 ] && data . arguments [ 1 ] . bidder === BIDDER_CODE ) {
1610
- storeErrorEventData ( data ) ;
1611
- }
1612
- }
1613
-
1614
- /**
1615
- * Get ixdiag stored in LocalStorage and format to be added to request payload
1616
- *
1617
- * @returns {Object } Object with error codes and counts
1618
- */
1619
- function getCachedErrors ( ) {
1620
- if ( ! storage . localStorageIsEnabled ( ) ) {
1621
- return ;
1622
- }
1623
-
1624
- const errors = { } ;
1625
- let currentStorage ;
1626
-
1627
- try {
1628
- currentStorage = JSON . parse ( storage . getDataFromLocalStorage ( LOCAL_STORAGE_KEY ) || '{}' ) ;
1629
- } catch ( e ) {
1630
- logError ( 'ix can not read ixdiag from localStorage.' ) ;
1631
- return null ;
1632
- }
1633
-
1634
- Object . keys ( currentStorage ) . forEach ( ( date ) => {
1635
- Object . keys ( currentStorage [ date ] ) . forEach ( ( code ) => {
1636
- if ( typeof currentStorage [ date ] [ code ] === 'number' ) {
1637
- errors [ code ] = errors [ code ]
1638
- ? errors [ code ] + currentStorage [ date ] [ code ]
1639
- : currentStorage [ date ] [ code ] ;
1640
- }
1641
- } ) ;
1642
- } ) ;
1643
-
1644
- return errors ;
1645
- }
1646
-
1647
1526
/**
1648
1527
*
1649
1528
* Initialize IX Outstream Renderer
@@ -1738,12 +1617,6 @@ export const spec = {
1738
1617
* @return {boolean } True if this is a valid bid, and false otherwise.
1739
1618
*/
1740
1619
isBidRequestValid : function ( bid ) {
1741
- if ( ! hasRegisteredHandler ) {
1742
- events . on ( EVENTS . AUCTION_DEBUG , localStorageHandler ) ;
1743
- events . on ( EVENTS . AD_RENDER_FAILED , localStorageHandler ) ;
1744
- hasRegisteredHandler = true ;
1745
- }
1746
-
1747
1620
const paramsVideoRef = deepAccess ( bid , 'params.video' ) ;
1748
1621
const paramsSize = deepAccess ( bid , 'params.size' ) ;
1749
1622
const mediaTypeBannerSizes = deepAccess ( bid , 'mediaTypes.banner.sizes' ) ;
@@ -1765,14 +1638,14 @@ export const spec = {
1765
1638
// since there is an ix bidder level size, make sure its valid
1766
1639
const ixSize = getFirstSize ( paramsSize ) ;
1767
1640
if ( ! ixSize ) {
1768
- logError ( 'IX Bid Adapter: size has invalid format.' , { bidder : BIDDER_CODE , code : ERROR_CODES . BID_SIZE_INVALID_FORMAT } ) ;
1641
+ logError ( 'IX Bid Adapter: size has invalid format.' ) ;
1769
1642
return false ;
1770
1643
}
1771
1644
// check if the ix bidder level size, is present in ad unit level
1772
1645
if ( ! includesSize ( bid . sizes , ixSize ) &&
1773
1646
! ( includesSize ( mediaTypeVideoPlayerSize , ixSize ) ) &&
1774
1647
! ( includesSize ( mediaTypeBannerSizes , ixSize ) ) ) {
1775
- logError ( 'IX Bid Adapter: bid size is not included in ad unit sizes or player size.' , { bidder : BIDDER_CODE , code : ERROR_CODES . BID_SIZE_NOT_INCLUDED } ) ;
1648
+ logError ( 'IX Bid Adapter: bid size is not included in ad unit sizes or player size.' ) ;
1776
1649
return false ;
1777
1650
}
1778
1651
}
@@ -1784,19 +1657,19 @@ export const spec = {
1784
1657
1785
1658
if ( bid . params . siteId !== undefined ) {
1786
1659
if ( typeof bid . params . siteId !== 'string' && typeof bid . params . siteId !== 'number' ) {
1787
- logError ( 'IX Bid Adapter: siteId must be string or number type.' , { bidder : BIDDER_CODE , code : ERROR_CODES . SITE_ID_INVALID_VALUE } ) ;
1660
+ logError ( 'IX Bid Adapter: siteId must be string or number type.' ) ;
1788
1661
return false ;
1789
1662
}
1790
1663
1791
1664
if ( typeof bid . params . siteId !== 'string' && isNaN ( Number ( bid . params . siteId ) ) ) {
1792
- logError ( 'IX Bid Adapter: siteId must valid value' , { bidder : BIDDER_CODE , code : ERROR_CODES . SITE_ID_INVALID_VALUE } ) ;
1665
+ logError ( 'IX Bid Adapter: siteId must valid value' ) ;
1793
1666
return false ;
1794
1667
}
1795
1668
}
1796
1669
1797
1670
if ( hasBidFloor || hasBidFloorCur ) {
1798
1671
if ( ! ( hasBidFloor && hasBidFloorCur && isValidBidFloorParams ( bid . params . bidFloor , bid . params . bidFloorCur ) ) ) {
1799
- logError ( 'IX Bid Adapter: bidFloor / bidFloorCur parameter has invalid format.' , { bidder : BIDDER_CODE , code : ERROR_CODES . BID_FLOOR_INVALID_FORMAT } ) ;
1672
+ logError ( 'IX Bid Adapter: bidFloor / bidFloorCur parameter has invalid format.' ) ;
1800
1673
return false ;
1801
1674
}
1802
1675
}
@@ -1815,7 +1688,7 @@ export const spec = {
1815
1688
1816
1689
if ( errorList . length ) {
1817
1690
errorList . forEach ( ( err ) => {
1818
- logError ( err , { bidder : BIDDER_CODE , code : ERROR_CODES . PROPERTY_NOT_INCLUDED } ) ;
1691
+ logError ( err ) ;
1819
1692
} ) ;
1820
1693
return false ;
1821
1694
}
@@ -1997,18 +1870,6 @@ export const spec = {
1997
1870
}
1998
1871
} ,
1999
1872
2000
- /**
2001
- * Covert bid param types for S2S
2002
- * @param {Object } params bid params
2003
- * @param {Boolean } isOpenRtb boolean to check openrtb2 protocol
2004
- * @return {Object } params bid params
2005
- */
2006
- transformBidParams : function ( params , isOpenRtb ) {
2007
- return convertTypes ( {
2008
- 'siteID' : 'number'
2009
- } , params ) ;
2010
- } ,
2011
-
2012
1873
/**
2013
1874
* Determine which user syncs should occur
2014
1875
* @param {object } syncOptions
0 commit comments