@@ -8,11 +8,10 @@ import { config } from '../src/config.js';
8
8
const BIDDER_CODE = 'tappx' ;
9
9
const TTL = 360 ;
10
10
const CUR = 'USD' ;
11
- const TAPPX_BIDDER_VERSION = '0.1.10420 ' ;
11
+ const TAPPX_BIDDER_VERSION = '0.1.10514 ' ;
12
12
const TYPE_CNN = 'prebidjs' ;
13
13
const VIDEO_SUPPORT = [ 'instream' ] ;
14
14
15
- var HOST ;
16
15
var hostDomain ;
17
16
18
17
export const spec = {
@@ -105,13 +104,31 @@ export const spec = {
105
104
}
106
105
107
106
function validBasic ( bid ) {
108
- if (
109
- ( bid . params == null ) ||
110
- ( bid . params . endpoint == null ) ||
111
- ( bid . params . tappxkey == null ) ) {
107
+ if ( bid . params == null ) {
112
108
utils . logWarn ( `[TAPPX]: Please review the mandatory Tappx parameters.` ) ;
113
109
return false ;
114
110
}
111
+
112
+ if ( bid . params . tappxkey == null ) {
113
+ utils . logWarn ( `[TAPPX]: Please review the mandatory Tappxkey parameter.` ) ;
114
+ return false ;
115
+ }
116
+
117
+ if ( bid . params . host == null ) {
118
+ utils . logWarn ( `[TAPPX]: Please review the mandatory Host parameter.` ) ;
119
+ return false ;
120
+ }
121
+
122
+ let classicEndpoint = true
123
+ if ( ( new RegExp ( `^(vz.*|zz.*)\.*$` , 'i' ) ) . test ( bid . params . host ) ) {
124
+ classicEndpoint = false
125
+ }
126
+
127
+ if ( classicEndpoint && bid . params . endpoint == null ) {
128
+ utils . logWarn ( `[TAPPX]: Please review the mandatory endpoint Tappx parameters.` ) ;
129
+ return false ;
130
+ }
131
+
115
132
return true ;
116
133
}
117
134
@@ -174,11 +191,10 @@ function interpretBid(serverBid, request) {
174
191
* @return response ad
175
192
*/
176
193
function buildOneRequest ( validBidRequests , bidderRequest ) {
177
- HOST = utils . deepAccess ( validBidRequests , 'params.host' ) ;
178
- let hostInfo = getHostInfo ( HOST ) ;
194
+ let hostInfo = getHostInfo ( validBidRequests ) ;
195
+ const ENDPOINT = hostInfo . endpoint ;
179
196
hostDomain = hostInfo . domain ;
180
197
181
- const ENDPOINT = utils . deepAccess ( validBidRequests , 'params.endpoint' ) ;
182
198
const TAPPXKEY = utils . deepAccess ( validBidRequests , 'params.tappxkey' ) ;
183
199
const BIDFLOOR = utils . deepAccess ( validBidRequests , 'params.bidfloor' ) ;
184
200
const BIDEXTRA = utils . deepAccess ( validBidRequests , 'params.ext' ) ;
@@ -359,7 +375,7 @@ function buildOneRequest(validBidRequests, bidderRequest) {
359
375
360
376
return {
361
377
method : 'POST' ,
362
- url : `https:// ${ HOST } / ${ ENDPOINT } ?type_cnn=${ TYPE_CNN } &v=${ TAPPX_BIDDER_VERSION } ` ,
378
+ url : `${ hostInfo . url } ?type_cnn=${ TYPE_CNN } &v=${ TAPPX_BIDDER_VERSION } ` ,
363
379
data : JSON . stringify ( payload ) ,
364
380
bids : validBidRequests
365
381
} ;
@@ -375,23 +391,24 @@ function getOs() {
375
391
if ( ua == null ) { return 'unknown' ; } else if ( ua . match ( / ( i P h o n e | i P o d | i P a d ) / ) ) { return 'ios' ; } else if ( ua . match ( / A n d r o i d / ) ) { return 'android' ; } else if ( ua . match ( / W i n d o w / ) ) { return 'windows' ; } else { return 'unknown' ; }
376
392
}
377
393
378
- function getHostInfo ( hostParam ) {
394
+ function getHostInfo ( validBidRequests ) {
379
395
let domainInfo = { } ;
396
+ let endpoint = utils . deepAccess ( validBidRequests , 'params.endpoint' ) ;
397
+ let hostParam = utils . deepAccess ( validBidRequests , 'params.host' ) ;
380
398
381
399
domainInfo . domain = hostParam . split ( '/' , 1 ) [ 0 ] ;
382
- domainInfo . url = hostParam ;
383
400
384
- let regexNewEndpoints = new RegExp ( `^(vz.*|zz.*|testing )\.ssp \.tappx\.com$` , 'i' ) ;
385
- let regexClassicEndpoints = new RegExp ( `^[a-z]{3}\.[a-z]{3}\.tappx\.com$` , 'i' ) ;
401
+ let regexNewEndpoints = new RegExp ( `^(vz.*|zz.*)\.pub \.tappx\.com$` , 'i' ) ;
402
+ let regexClassicEndpoints = new RegExp ( `^( [a-z]{3}|testing) \.[a-z]{3}\.tappx\.com$` , 'i' ) ;
386
403
387
404
if ( regexNewEndpoints . test ( domainInfo . domain ) ) {
388
- let endpoint = domainInfo . domain . split ( '.' , 1 ) [ 0 ]
389
- if ( endpoint . toUpperCase ( ) . indexOf ( 'TESTING' ) === - 1 ) {
390
- domainInfo . endpoint = endpoint
391
- domainInfo . new_endpoint = true ;
392
- }
405
+ domainInfo . newEndpoint = true ;
406
+ domainInfo . endpoint = domainInfo . domain . split ( '.' , 1 ) [ 0 ]
407
+ domainInfo . url = `https://${ hostParam } `
393
408
} else if ( regexClassicEndpoints . test ( domainInfo . domain ) ) {
394
- domainInfo . new_endpoint = false ;
409
+ domainInfo . newEndpoint = false ;
410
+ domainInfo . endpoint = endpoint
411
+ domainInfo . url = `https://${ hostParam } ${ endpoint } `
395
412
}
396
413
397
414
return domainInfo ;
0 commit comments