{"version":3,"sources":["webpack:///./modules/astraoneBidAdapter.js"],"names":["BIDDER_CODE","SSP_ENDPOINT","TTL","buildBidRequests","validBidRequests","_map","validBidRequest","params","bidRequest","bidId","transactionId","sizes","placement","placeId","imageUrl","buildBid","bidData","bid","requestId","cpm","price","width","height","creativeId","content","seanceId","currency","netRevenue","meta","mediaType","BANNER","ttl","ad","wrapAd","getMediaTypeFromBid","mediaTypes","Object","keys","encodeURIComponent","JSON","stringify","spec","code","supportedMediaTypes","isBidRequestValid","buildRequests","bidderRequest","payload","url","refererInfo","referer","cmp","gdprConsent","bidRequests","gdprApplies","undefined","consentString","payloadString","method","data","options","contentType","interpretResponse","serverResponse","bids","body","Array","isArray","map","registerBidder","window","d2ppbjs","installedModules","push"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEA,IAAMA,WAAW,GAAG,UAApB;AACA,IAAMC,YAAY,GAAG,wCAArB;AACA,IAAMC,GAAG,GAAG,EAAZ;;AAEA,SAASC,gBAAT,CAA0BC,gBAA1B,EAA4C;AAC1C,SAAOC,2DAAI,CAACD,gBAAD,EAAmB,UAASE,eAAT,EAA0B;AACtD,QAAMC,MAAM,GAAGD,eAAe,CAACC,MAA/B;AACA,QAAMC,UAAU,GAAG;AACjBC,WAAK,EAAEH,eAAe,CAACG,KADN;AAEjBC,mBAAa,EAAEJ,eAAe,CAACI,aAFd;AAGjBC,WAAK,EAAEL,eAAe,CAACK,KAHN;AAIjBC,eAAS,EAAEL,MAAM,CAACK,SAJD;AAKjBC,aAAO,EAAEN,MAAM,CAACM,OALC;AAMjBC,cAAQ,EAAEP,MAAM,CAACO;AANA,KAAnB;AASA,WAAON,UAAP;AACD,GAZU,CAAX;AAaD;;AAED,SAASO,QAAT,CAAkBC,OAAlB,EAA2B;AACzB,MAAMC,GAAG,GAAG;AACVC,aAAS,EAAEF,OAAO,CAACP,KADT;AAEVU,OAAG,EAAEH,OAAO,CAACI,KAFH;AAGVC,SAAK,EAAEL,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neBidAdapter.js","sourcesContent":["import { _map } from '../src/utils.js';\r\nimport { registerBidder } from '../src/adapters/bidderFactory.js'\r\nimport { BANNER } from '../src/mediaTypes.js'\r\n\r\nconst BIDDER_CODE = 'astraone';\r\nconst SSP_ENDPOINT = 'https://ssp.astraone.io/auction/prebid';\r\nconst TTL = 60;\r\n\r\nfunction buildBidRequests(validBidRequests) {\r\n return _map(validBidRequests, function(validBidRequest) {\r\n const params = validBidRequest.params;\r\n const bidRequest = {\r\n bidId: validBidRequest.bidId,\r\n transactionId: validBidRequest.transactionId,\r\n sizes: validBidRequest.sizes,\r\n placement: params.placement,\r\n placeId: params.placeId,\r\n imageUrl: params.imageUrl\r\n };\r\n\r\n return bidRequest;\r\n })\r\n}\r\n\r\nfunction buildBid(bidData) {\r\n const bid = {\r\n requestId: bidData.bidId,\r\n cpm: bidData.price,\r\n width: bidData.width,\r\n height: bidData.height,\r\n creativeId: bidData.content.seanceId,\r\n currency: bidData.currency,\r\n netRevenue: true,\r\n meta: {\r\n mediaType: BANNER,\r\n },\r\n ttl: TTL,\r\n content: bidData.content\r\n };\r\n\r\n bid.ad = wrapAd(bid, bidData);\r\n\r\n return bid;\r\n}\r\n\r\nfunction getMediaTypeFromBid(bid) {\r\n return bid.mediaTypes && Object.keys(bid.mediaTypes)[0]\r\n}\r\n\r\nfunction wrapAd(bid, bidData) {\r\n return `\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n `;\r\n}\r\n\r\nexport const spec = {\r\n code: BIDDER_CODE,\r\n supportedMediaTypes: [BANNER],\r\n\r\n /**\r\n * Determines whether or not the given bid request is valid.\r\n *\r\n * @param {BidRequest} bid The bid params to validate.\r\n * @return boolean True if this is a valid bid, and false otherwise.\r\n */\r\n isBidRequestValid(bid) {\r\n return (\r\n getMediaTypeFromBid(bid) === BANNER &&\r\n !!bid.params.placeId &&\r\n !!bid.params.imageUrl &&\r\n !!bid.params.placement &&\r\n (bid.params.placement === 'inImage')\r\n );\r\n },\r\n\r\n /**\r\n * Make a server request from the list of BidRequests.\r\n *\r\n * @param {validBidRequests[]} - an array of bids\r\n * @return ServerRequest Info describing the request to the server.\r\n */\r\n buildRequests(validBidRequests, bidderRequest) {\r\n const payload = {\r\n url: bidderRequest.refererInfo.referer,\r\n cmp: !!bidderRequest.gdprConsent,\r\n bidRequests: buildBidRequests(validBidRequests)\r\n };\r\n\r\n if (payload.cmp) {\r\n const gdprApplies = bidderRequest.gdprConsent.gdprApplies;\r\n if (gdprApplies !== undefined) payload['ga'] = gdprApplies;\r\n payload['cs'] = bidderRequest.gdprConsent.consentString;\r\n }\r\n\r\n const payloadString = JSON.stringify(payload);\r\n return {\r\n method: 'POST',\r\n url: SSP_ENDPOINT,\r\n data: payloadString,\r\n options: {\r\n contentType: 'application/json'\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Unpack the response from the server into a list of bids.\r\n *\r\n * @param {ServerResponse} serverResponse A successful response from the server.\r\n * @return {Bid[]} An array of bids which were nested inside the server.\r\n */\r\n interpretResponse: function(serverResponse) {\r\n const bids = serverResponse.body && serverResponse.body.bids;\r\n\r\n return Array.isArray(bids) ? bids.map(bid => buildBid(bid)) : []\r\n }\r\n\r\n}\r\nregisterBidder(spec);\r\n\n\n\n// WEBPACK FOOTER //\n// ./modules/astraoneBidAdapter.js"],"sourceRoot":""}