@@ -11,7 +11,7 @@ export const spec = {
11
11
supportedMediaTypes : [ BANNER , VIDEO ] ,
12
12
13
13
isBidRequestValid : function ( bid ) {
14
- return ! ! ( bid . params . account && bid . params . location && bid . params . format ) ;
14
+ return ! ! ( bid . params . account && bid . params . location && ( bid . params . format || bid . mediaTypes . banner . sizes ) ) ;
15
15
} ,
16
16
17
17
buildRequests : function ( validBidRequests , bidderRequest ) {
@@ -83,7 +83,10 @@ function adResponse(bid, ad) {
83
83
width : Number ( ad . width ) ,
84
84
height : Number ( ad . height ) ,
85
85
creativeId : adDetails . creativeId ,
86
- dealId : adDetails . dealId
86
+ dealId : adDetails . dealId ,
87
+ adhese : {
88
+ originData : adDetails . originData
89
+ }
87
90
} ) ;
88
91
89
92
if ( bidResponse . mediaType === VIDEO ) {
@@ -112,7 +115,19 @@ function mergeTargets(targets, target) {
112
115
}
113
116
114
117
function bidToSlotName ( bid ) {
115
- return bid . params . location + '-' + bid . params . format ;
118
+ if ( bid . params . format ) {
119
+ return bid . params . location + '-' + bid . params . format ;
120
+ }
121
+
122
+ var sizes = bid . mediaTypes . banner . sizes ;
123
+ sizes . sort ( ) ;
124
+ var format = sizes . map ( size => size [ 0 ] + 'x' + size [ 1 ] ) . join ( '_' ) ;
125
+
126
+ if ( format . length > 0 ) {
127
+ return bid . params . location + '-' + format ;
128
+ } else {
129
+ return bid . params . location ;
130
+ }
116
131
}
117
132
118
133
function getAccount ( validBidRequests ) {
@@ -150,22 +165,27 @@ function getPrice(ad) {
150
165
function getAdDetails ( ad ) {
151
166
let creativeId = '' ;
152
167
let dealId = '' ;
168
+ let originData = { } ;
153
169
154
170
if ( isAdheseAd ( ad ) ) {
155
171
creativeId = ad . id ;
156
172
dealId = ad . orderId ;
173
+ originData = { priority : ad . priority , orderProperty : ad . orderProperty , adFormat : ad . adFormat , adType : ad . adType , libId : ad . libId , adspaceId : ad . adspaceId , viewableImpressionCounter : ad . viewableImpressionCounter } ;
157
174
} else {
158
175
creativeId = ad . origin + ( ad . originInstance ? '-' + ad . originInstance : '' ) ;
159
- if ( ad . originData && ad . originData . seatbid && ad . originData . seatbid . length ) {
160
- const seatbid = ad . originData . seatbid [ 0 ] ;
161
- if ( seatbid . bid && seatbid . bid . length ) {
162
- const bid = seatbid . bid [ 0 ] ;
163
- creativeId = String ( bid . crid || '' ) ;
164
- dealId = String ( bid . dealid || '' ) ;
176
+ if ( ad . originData ) {
177
+ originData = ad . originData ;
178
+ if ( ad . originData . seatbid && ad . originData . seatbid . length ) {
179
+ const seatbid = ad . originData . seatbid [ 0 ] ;
180
+ if ( seatbid . bid && seatbid . bid . length ) {
181
+ const bid = seatbid . bid [ 0 ] ;
182
+ creativeId = String ( bid . crid || '' ) ;
183
+ dealId = String ( bid . dealid || '' ) ;
184
+ }
165
185
}
166
186
}
167
187
}
168
- return { creativeId : creativeId , dealId : dealId } ;
188
+ return { creativeId : creativeId , dealId : dealId , originData : originData } ;
169
189
}
170
190
171
191
function base64urlEncode ( s ) {
0 commit comments