diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js
deleted file mode 100644
index d30be635a50..00000000000
--- a/modules/freewheel-sspBidAdapter.js
+++ /dev/null
@@ -1,606 +0,0 @@
-import { logWarn, isArray, isFn, deepAccess, formatQS } from '../src/utils.js';
-import { BANNER, VIDEO } from '../src/mediaTypes.js';
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { config } from '../src/config.js';
-
-/**
- * @typedef {import('../src/adapters/bidderFactory.js').BidRequest} BidRequest
- * @typedef {import('../src/adapters/bidderFactory.js').Bid} Bid
- */
-
-const BIDDER_CODE = 'freewheel-ssp';
-const GVL_ID = 285;
-
-const PROTOCOL = getProtocol();
-const FREEWHEEL_ADSSETUP = PROTOCOL + '://ads.stickyadstv.com/www/delivery/swfIndex.php';
-const MUSTANG_URL = PROTOCOL + '://cdn.stickyadstv.com/mustang/mustang.min.js';
-const PRIMETIME_URL = PROTOCOL + '://cdn.stickyadstv.com/prime-time/';
-const USER_SYNC_URL = PROTOCOL + '://ads.stickyadstv.com/auto-user-sync';
-
-function getProtocol() {
- return 'https';
-}
-
-function isValidUrl(str) {
- if (!str) {
- return false;
- }
-
- // regExp for url validation
- var pattern = /^(https?|ftp|file):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
- return pattern.test(str);
-}
-
-function getBiggerSize(array) {
- var result = [0, 0];
- for (var i = 0; i < array.length; i++) {
- if (array[i][0] * array[i][1] > result[0] * result[1]) {
- result = array[i];
- }
- }
- return result;
-}
-
-function getBiggerSizeWithLimit(array, minSizeLimit, maxSizeLimit) {
- var minSize = minSizeLimit || [0, 0];
- var maxSize = maxSizeLimit || [Number.MAX_VALUE, Number.MAX_VALUE];
- var candidates = [];
-
- for (var i = 0; i < array.length; i++) {
- if (array[i][0] * array[i][1] >= minSize[0] * minSize[1] && array[i][0] * array[i][1] <= maxSize[0] * maxSize[1]) {
- candidates.push(array[i]);
- }
- }
-
- return getBiggerSize(candidates);
-}
-
-/*
-* read the pricing extension with this format: 1.0000
-* @return {object} pricing data in format: {currency: "EUR", price:"1.000"}
-*/
-function getPricing(xmlNode) {
- var pricingExtNode;
- var princingData = {};
-
- var extensions = xmlNode.querySelectorAll('Extension');
- // Nodelist.forEach is not supported in IE and Edge
- // Workaround given here https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10638731/
- Array.prototype.forEach.call(extensions, function(node) {
- if (node.getAttribute('type') === 'StickyPricing') {
- pricingExtNode = node;
- }
- });
-
- if (pricingExtNode) {
- var priceNode = pricingExtNode.querySelector('Price');
- princingData = {
- currency: priceNode.getAttribute('currency'),
- price: priceNode.textContent
- };
- } else {
- logWarn('PREBID - ' + BIDDER_CODE + ': No bid received or missing pricing extension.');
- }
-
- return princingData;
-}
-
-/*
-* Read the StickyBrand extension with this format:
-*
-*
-*
-*
-*
-*
-* @return {object} pricing data in format: {currency: "EUR", price:"1.000"}
-*/
-function getAdvertiserDomain(xmlNode) {
- var domain = [];
- var brandExtNode;
- var extensions = xmlNode.querySelectorAll('Extension');
- // Nodelist.forEach is not supported in IE and Edge
- // Workaround given here https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10638731/
- Array.prototype.forEach.call(extensions, function(node) {
- if (node.getAttribute('type') === 'StickyBrand') {
- brandExtNode = node;
- }
- });
-
- // Currently we only return one Domain
- if (brandExtNode) {
- var domainNode = brandExtNode.querySelector('Domain');
- domain.push(domainNode.textContent);
- } else {
- logWarn('PREBID - ' + BIDDER_CODE + ': No bid received or missing StickyBrand extension.');
- }
-
- return domain;
-}
-
-function hashcode(inputString) {
- var hash = 0;
- var char;
- if (inputString.length == 0) return hash;
- for (var i = 0; i < inputString.length; i++) {
- char = inputString.charCodeAt(i);
- hash = ((hash << 5) - hash) + char;
- hash = hash & hash; // Convert to 32bit integer
- }
- return hash;
-}
-
-function getCreativeId(xmlNode) {
- var creaId = '';
- var adNodes = xmlNode.querySelectorAll('Ad');
- // Nodelist.forEach is not supported in IE and Edge
- // Workaround given here https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10638731/
- Array.prototype.forEach.call(adNodes, function(el) {
- creaId += '[' + el.getAttribute('id') + ']';
- });
-
- return creaId;
-}
-
-function getValueFromKeyInImpressionNode(xmlNode, key) {
- var value = '';
- var impNodes = xmlNode.querySelectorAll('Impression'); // Nodelist.forEach is not supported in IE and Edge
- var isRootViewKeyPresent = false;
- var isAdsDisplayStartedPresent = false;
- Array.prototype.forEach.call(impNodes, function (el) {
- if (isRootViewKeyPresent && isAdsDisplayStartedPresent) {
- return value;
- }
- isRootViewKeyPresent = false;
- isAdsDisplayStartedPresent = false;
- var text = el.textContent;
- var queries = text.substring(el.textContent.indexOf('?') + 1).split('&');
- var tempValue = '';
- Array.prototype.forEach.call(queries, function (item) {
- var split = item.split('=');
- if (split[0] == key) {
- tempValue = split[1];
- }
- if (split[0] == 'reqType' && split[1] == 'AdsDisplayStarted') {
- isAdsDisplayStartedPresent = true;
- }
- if (split[0] == 'rootViewKey') {
- isRootViewKeyPresent = true;
- }
- });
- if (isAdsDisplayStartedPresent) {
- value = tempValue;
- }
- });
- return value;
-}
-
-function getDealId(xmlNode) {
- return getValueFromKeyInImpressionNode(xmlNode, 'dealId');
-}
-
-function getBannerId(xmlNode) {
- return getValueFromKeyInImpressionNode(xmlNode, 'adId');
-}
-
-function getCampaignId(xmlNode) {
- return getValueFromKeyInImpressionNode(xmlNode, 'campaignId');
-}
-
-/**
- * returns the top most accessible window
- */
-function getTopMostWindow() {
- var res = window;
-
- try {
- while (top !== res) {
- if (res.parent.location.href.length) { res = res.parent; }
- }
- } catch (e) {}
-
- return res;
-}
-
-function getComponentId(inputFormat) {
- var component = 'mustang'; // default component id
-
- if (inputFormat && inputFormat !== 'inbanner') {
- // format identifiers are equals to their component ids.
- component = inputFormat;
- }
-
- return component;
-}
-
-function getAPIName(componentId) {
- componentId = componentId || '';
-
- // remove dash in componentId to get API name
- return componentId.replace('-', '');
-}
-
-function getBidFloor(bid, config) {
- if (!isFn(bid.getFloor)) {
- return deepAccess(bid, 'params.bidfloor', 0);
- }
-
- try {
- const bidFloor = bid.getFloor({
- currency: getFloorCurrency(config),
- mediaType: typeof bid.mediaTypes['banner'] == 'object' ? 'banner' : 'video',
- size: '*',
- });
- return bidFloor?.floor;
- } catch (e) {
- return -1;
- }
-}
-
-function getFloorCurrency(config) {
- return config.getConfig('floors.data.currency') != null ? config.getConfig('floors.data.currency') : 'USD';
-}
-
-function formatAdHTML(bid, size) {
- var integrationType = bid.params.format;
-
- var divHtml = '
';
-
- var script = '';
- var libUrl = '';
- if (integrationType && integrationType !== 'inbanner') {
- libUrl = PRIMETIME_URL + getComponentId(bid.params.format) + '.min.js';
- script = getOutstreamScript(bid);
- } else {
- libUrl = MUSTANG_URL;
- script = getInBannerScript(bid, size);
- }
-
- return divHtml +
- '';
-}
-
-var getInBannerScript = function(bid, size) {
- return 'var config = {' +
- ' preloadedVast:vast,' +
- ' autoPlay:true' +
- ' };' +
- ' var ad = new window.com.stickyadstv.vpaid.Ad(document.getElementById("freewheelssp_prebid_target"),config);' +
- ' (new window.com.stickyadstv.tools.ASLoader(' + bid.params.zoneId + ', \'' + getComponentId(bid.params.format) + '\')).registerEvents(ad);' +
- ' ad.initAd(' + size[0] + ',' + size[1] + ',"",0,"","");';
-};
-
-var getOutstreamScript = function(bid) {
- var config = bid.params;
-
- // default placement if no placement is set
- if (!config.hasOwnProperty('domId') && !config.hasOwnProperty('auto') && !config.hasOwnProperty('p') && !config.hasOwnProperty('article')) {
- if (config.format === 'intext-roll') {
- config.iframeMode = 'dfp';
- } else {
- config.domId = 'freewheelssp_prebid_target';
- }
- }
-
- var script = 'var config = {' +
- ' preloadedVast:vast,' +
- ' ASLoader:new window.com.stickyadstv.tools.ASLoader(' + bid.params.zoneId + ', \'' + getComponentId(bid.params.format) + '\')';
-
- for (var key in config) {
- // dont' send format parameter
- // neither zone nor vastUrlParams value as Vast is already loaded
- if (config.hasOwnProperty(key) && key !== 'format' && key !== 'zone' && key !== 'zoneId' && key !== 'vastUrlParams') {
- script += ',' + key + ':"' + config[key] + '"';
- }
- }
- script += '};' +
-
- 'window.com.stickyadstv.' + getAPIName(bid.params.format) + '.start(config);';
-
- return script;
-};
-
-export const spec = {
- code: BIDDER_CODE,
- gvlid: GVL_ID,
- supportedMediaTypes: [BANNER, VIDEO],
- aliases: ['stickyadstv', 'freewheelssp'], // aliases for freewheel-ssp
- /**
- * Determines whether or not the given bid request is valid.
- *
- * @param {object} bid The bid to validate.
- * @return boolean True if this is a valid bid, and false otherwise.
- */
- isBidRequestValid: function(bid) {
- return !!(bid.params.zoneId);
- },
-
- /**
- * Make a server request from the list of BidRequests.
- *
- * @param {BidRequest[]} bidRequests A non-empty list of bid requests which should be sent to the Server.
- * @return ServerRequest Info describing the request to the server.
- */
- buildRequests: function(bidRequests, bidderRequest) {
- // var currency = config.getConfig(currency);
-
- let buildRequest = (currentBidRequest, bidderRequest) => {
- var zone = currentBidRequest.params.zoneId;
- var timeInMillis = new Date().getTime();
- var keyCode = hashcode(zone + '' + timeInMillis);
- var bidfloor = getBidFloor(currentBidRequest, config);
- var format = currentBidRequest.params.format;
-
- var requestParams = {
- reqType: 'AdsSetup',
- protocolVersion: '4.2',
- zoneId: zone,
- componentId: 'prebid',
- componentSubId: getComponentId(currentBidRequest.params.format),
- timestamp: timeInMillis,
- _fw_bidfloor: (bidfloor > 0) ? bidfloor : 0,
- _fw_bidfloorcur: (bidfloor > 0) ? getFloorCurrency(config) : '',
- pbjs_version: '$prebid.version$',
- pKey: keyCode
- };
-
- // Add GDPR flag and consent string
- if (bidderRequest && bidderRequest.gdprConsent) {
- requestParams._fw_gdpr_consent = bidderRequest.gdprConsent.consentString;
-
- if (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') {
- requestParams._fw_gdpr = bidderRequest.gdprConsent.gdprApplies;
- }
- }
-
- if (currentBidRequest.params.gdpr_consented_providers) {
- requestParams._fw_gdpr_consented_providers = currentBidRequest.params.gdpr_consented_providers;
- }
-
- // Add CCPA consent string
- if (bidderRequest && bidderRequest.uspConsent) {
- requestParams._fw_us_privacy = bidderRequest.uspConsent;
- }
-
- // Add GPP consent
- if (bidderRequest && bidderRequest.gppConsent) {
- requestParams.gpp = bidderRequest.gppConsent.gppString;
- requestParams.gpp_sid = bidderRequest.gppConsent.applicableSections;
- } else if (bidderRequest && bidderRequest.ortb2 && bidderRequest.ortb2.regs && bidderRequest.ortb2.regs.gpp) {
- requestParams.gpp = bidderRequest.ortb2.regs.gpp;
- requestParams.gpp_sid = bidderRequest.ortb2.regs.gpp_sid;
- }
-
- // Add content object
- if (bidderRequest && bidderRequest.ortb2 && bidderRequest.ortb2.site && bidderRequest.ortb2.site.content && typeof bidderRequest.ortb2.site.content === 'object') {
- try {
- requestParams._fw_prebid_content = JSON.stringify(bidderRequest.ortb2.site.content);
- } catch (error) {
- logWarn('PREBID - ' + BIDDER_CODE + ': Unable to stringify the content object: ' + error);
- }
- }
-
- // Add schain object
- var schain = currentBidRequest?.ortb2?.source?.ext?.schain;
- if (schain) {
- try {
- requestParams.schain = JSON.stringify(schain);
- } catch (error) {
- logWarn('PREBID - ' + BIDDER_CODE + ': Unable to stringify the schain: ' + error);
- }
- }
-
- if (currentBidRequest.userIdAsEids && currentBidRequest.userIdAsEids.length > 0) {
- try {
- requestParams._fw_prebid_3p_UID = JSON.stringify(currentBidRequest.userIdAsEids);
- } catch (error) {
- logWarn('PREBID - ' + BIDDER_CODE + ': Unable to stringify the userIdAsEids: ' + error);
- }
- }
-
- var vastParams = currentBidRequest.params.vastUrlParams;
- if (typeof vastParams === 'object') {
- for (var key in vastParams) {
- if (vastParams.hasOwnProperty(key)) {
- requestParams[key] = vastParams[key];
- }
- }
- }
-
- var location = bidderRequest?.refererInfo?.page;
- if (isValidUrl(location)) {
- requestParams.loc = location;
- }
-
- var playerSize = [];
- if (currentBidRequest.mediaTypes.video && currentBidRequest.mediaTypes.video.playerSize) {
- // If mediaTypes is video, get size from mediaTypes.video.playerSize per http://prebid.org/blog/pbjs-3
- if (isArray(currentBidRequest.mediaTypes.video.playerSize[0])) {
- playerSize = currentBidRequest.mediaTypes.video.playerSize[0];
- } else {
- playerSize = currentBidRequest.mediaTypes.video.playerSize;
- }
- } else if (currentBidRequest.mediaTypes.banner.sizes) {
- // If mediaTypes is banner, get size from mediaTypes.banner.sizes per http://prebid.org/blog/pbjs-3
- playerSize = getBiggerSizeWithLimit(currentBidRequest.mediaTypes.banner.sizes, currentBidRequest.mediaTypes.banner.minSizeLimit, currentBidRequest.mediaTypes.banner.maxSizeLimit);
- } else {
- // Backward compatible code, in case size still pass by sizes in bid request
- playerSize = getBiggerSize(currentBidRequest.sizes);
- }
-
- if (playerSize[0] > 0 || playerSize[1] > 0) {
- requestParams.playerSize = playerSize[0] + 'x' + playerSize[1];
- }
-
- // Add video context and placement in requestParams
- if (currentBidRequest.mediaTypes.video) {
- var videoContext = currentBidRequest.mediaTypes.video.context ? currentBidRequest.mediaTypes.video.context : '';
- var videoPlacement = currentBidRequest.mediaTypes.video.placement ? currentBidRequest.mediaTypes.video.placement : null;
- var videoPlcmt = currentBidRequest.mediaTypes.video.plcmt ? currentBidRequest.mediaTypes.video.plcmt : null;
-
- if (format == 'inbanner') {
- videoPlacement = 2;
- videoContext = 'In-Banner';
- }
- requestParams.video_context = videoContext;
- requestParams.video_placement = videoPlacement;
- requestParams.video_plcmt = videoPlcmt;
- }
-
- return {
- method: 'GET',
- url: FREEWHEEL_ADSSETUP,
- data: requestParams,
- bidRequest: currentBidRequest
- };
- };
-
- return bidRequests.map(function(currentBidRequest) {
- return buildRequest(currentBidRequest, bidderRequest);
- });
- },
-
- /**
- * Unpack the response from the server into a list of bids.
- *
- * @param {*} serverResponse A successful response from the server.
- * @param {object} request the built request object containing the initial bidRequest.
- * @return {Bid[]} An array of bids which were nested inside the server.
- */
- interpretResponse: function(serverResponse, request) {
- var bidrequest = request.bidRequest;
- var playerSize = [];
- if (bidrequest.mediaTypes.video && bidrequest.mediaTypes.video.playerSize) {
- // If mediaTypes is video, get size from mediaTypes.video.playerSize per http://prebid.org/blog/pbjs-3
- if (isArray(bidrequest.mediaTypes.video.playerSize[0])) {
- playerSize = bidrequest.mediaTypes.video.playerSize[0];
- } else {
- playerSize = bidrequest.mediaTypes.video.playerSize;
- }
- } else if (bidrequest.mediaTypes.banner.sizes) {
- // If mediaTypes is banner, get size from mediaTypes.banner.sizes per http://prebid.org/blog/pbjs-3
- playerSize = getBiggerSizeWithLimit(bidrequest.mediaTypes.banner.sizes, bidrequest.mediaTypes.banner.minSizeLimit, bidrequest.mediaTypes.banner.maxSizeLimit);
- } else {
- // Backward compatible code, in case size still pass by sizes in bid request
- playerSize = getBiggerSize(bidrequest.sizes);
- }
-
- if (typeof serverResponse == 'object' && typeof serverResponse.body == 'string') {
- serverResponse = serverResponse.body;
- }
-
- var xmlDoc;
- try {
- var parser = new DOMParser();
- xmlDoc = parser.parseFromString(serverResponse, 'application/xml');
- } catch (err) {
- logWarn('Prebid.js - ' + BIDDER_CODE + ' : ' + err);
- return;
- }
-
- const princingData = getPricing(xmlDoc);
- const creativeId = getCreativeId(xmlDoc);
- const dealId = getDealId(xmlDoc);
- const campaignId = getCampaignId(xmlDoc);
- const bannerId = getBannerId(xmlDoc);
- const topWin = getTopMostWindow();
- const advertiserDomains = getAdvertiserDomain(xmlDoc);
-
- if (!topWin.freewheelssp_cache) {
- topWin.freewheelssp_cache = {};
- }
- topWin.freewheelssp_cache[bidrequest.adUnitCode] = serverResponse;
-
- const bidResponses = [];
-
- if (princingData.price) {
- const bidResponse = {
- requestId: bidrequest.bidId,
- cpm: princingData.price,
- width: playerSize[0],
- height: playerSize[1],
- creativeId: creativeId,
- currency: princingData.currency,
- netRevenue: true,
- ttl: 360,
- meta: { advertiserDomains: advertiserDomains },
- dealId: dealId,
- campaignId: campaignId,
- bannerId: bannerId
- };
-
- if (bidrequest.mediaTypes.video) {
- bidResponse.mediaType = 'video';
- }
-
- bidResponse.vastXml = serverResponse;
-
- bidResponse.ad = formatAdHTML(bidrequest, playerSize);
- bidResponses.push(bidResponse);
- }
-
- return bidResponses;
- },
-
- getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy, gppConsent) {
- const params = {};
-
- if (gdprConsent) {
- if (typeof gdprConsent.gdprApplies === 'boolean') {
- params.gdpr = Number(gdprConsent.gdprApplies);
- params.gdpr_consent = gdprConsent.consentString;
- } else {
- params.gdpr_consent = gdprConsent.consentString;
- }
- }
-
- if (gppConsent) {
- if (typeof gppConsent.gppString === 'string') {
- params.gpp = gppConsent.gppString;
- }
- if (gppConsent.applicableSections) {
- params.gpp_sid = gppConsent.applicableSections;
- }
- }
-
- var queryString = '';
- if (params) {
- queryString = '?' + `${formatQS(params)}`;
- }
-
- const syncs = [];
- if (syncOptions && syncOptions.pixelEnabled) {
- syncs.push({
- type: 'image',
- url: USER_SYNC_URL + queryString
- });
- } else if (syncOptions.iframeEnabled) {
- syncs.push({
- type: 'iframe',
- url: USER_SYNC_URL + queryString
- });
- }
-
- return syncs;
- },
-};
-
-registerBidder(spec);
diff --git a/modules/freewheel-sspBidAdapter.md b/modules/freewheel-sspBidAdapter.md
deleted file mode 100644
index a445280f2b0..00000000000
--- a/modules/freewheel-sspBidAdapter.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Overview
-
-Module Name: Freewheel SSP Bidder Adapter
-Module Type: Bidder Adapter
-Maintainer: clientsidesdk@freewheel.tv
-
-# Description
-
-Module that connects to Freewheel ssp's demand sources
-
-# Test Parameters
-```
- var adUnits = [
- {
- code: 'test-div',
-
- mediaTypes: {
- banner: {
- sizes: [[300, 250]], // a display size
- }
- },
-
- bids: [
- {
- bidder: "freewheelssp", // or use alias "freewheel-ssp"
- params: {
- zoneId : '277225'
- }
- }
- ]
- }
- ];
-```
diff --git a/test/spec/modules/freewheel-sspBidAdapter_spec.js b/test/spec/modules/freewheel-sspBidAdapter_spec.js
deleted file mode 100644
index e96208c3b16..00000000000
--- a/test/spec/modules/freewheel-sspBidAdapter_spec.js
+++ /dev/null
@@ -1,738 +0,0 @@
-import { expect } from 'chai';
-import { spec } from 'modules/freewheel-sspBidAdapter.js';
-import { newBidder } from 'src/adapters/bidderFactory.js';
-import { createEidsArray } from 'modules/userId/eids.js';
-import { config } from 'src/config.js';
-
-const ENDPOINT = '//ads.stickyadstv.com/www/delivery/swfIndex.php';
-const PREBID_VERSION = '$prebid.version$';
-
-describe('freewheelSSP BidAdapter Test', () => {
- const adapter = newBidder(spec);
-
- describe('inherited functions', () => {
- it('exists and is a function', () => {
- expect(adapter.callBids).to.exist.and.to.be.a('function');
- });
- });
-
- describe('isBidRequestValidForBanner', () => {
- let bid = {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [
- [300, 250], [300, 600]
- ]
- }
- },
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
-
- it('should return true when required params found', () => {
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- });
-
- it('should return false when required params are not passed', () => {
- let invalidBid = Object.assign({}, bid);
- delete invalidBid.params;
- invalidBid.params = {
- wrong: 'missing zone id'
- };
- expect(spec.isBidRequestValid(invalidBid)).to.equal(false);
- });
- });
-
- describe('isBidRequestValidForVideo', () => {
- let bid = {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'video': {
- 'playerSize': [300, 250],
- }
- },
- 'sizes': [[300, 250]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
-
- it('should return true when required params found', () => {
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- });
-
- it('should return false when required params are not passed', () => {
- let invalidBid = Object.assign({}, bid);
- delete invalidBid.params;
- invalidBid.params = {
- wrong: 'missing zone id'
- };
- expect(spec.isBidRequestValid(invalidBid)).to.equal(false);
- });
- });
-
- describe('buildRequestsForBanner', () => {
- let bidRequests = [
- {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225',
- 'bidfloor': 2.00,
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [
- [300, 250], [300, 600]
- ]
- }
- },
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- 'ortb2': {
- 'source': {
- 'ext': {
- 'schain': {
- 'ver': '1.0',
- 'complete': 1,
- 'nodes': [
- {
- 'asi': 'example.com',
- 'sid': '0',
- 'hp': 1,
- 'rid': 'bidrequestid',
- 'domain': 'example.com'
- }
- ]
- }
- }
- }
- }
- }
- ];
-
- it('should get bidfloor value from params if no getFloor method', () => {
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload._fw_bidfloor).to.equal(2.00);
- expect(payload._fw_bidfloorcur).to.deep.equal('USD');
- });
-
- it('should get bidfloor value from getFloor method if available', () => {
- const bidRequest = bidRequests[0];
- bidRequest.getFloor = () => ({ currency: 'USD', floor: 1.16 });
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload._fw_bidfloor).to.equal(1.16);
- expect(payload._fw_bidfloorcur).to.deep.equal('USD');
- });
-
- it('should pass 3rd party IDs with the request when present', function () {
- const bidRequest = bidRequests[0];
- bidRequest.userIdAsEids = [
- {source: 'adserver.org', uids: [{id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: {rtiPartner: 'TDID'}}]},
- {source: 'admixer.net', uids: [{id: 'admixerId_FROM_USER_ID_MODULE', atype: 3}]},
- {source: 'adtelligent.com', uids: [{id: 'adtelligentId_FROM_USER_ID_MODULE', atype: 3}]},
- ];
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload._fw_prebid_3p_UID).to.deep.equal(JSON.stringify([
- {source: 'adserver.org', uids: [{id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: {rtiPartner: 'TDID'}}]},
- {source: 'admixer.net', uids: [{id: 'admixerId_FROM_USER_ID_MODULE', atype: 3}]},
- {source: 'adtelligent.com', uids: [{id: 'adtelligentId_FROM_USER_ID_MODULE', atype: 3}]},
- ]));
- });
-
- it('should return empty bidFloorCurrency when bidfloor <= 0', () => {
- const bidRequest = bidRequests[0];
- bidRequest.getFloor = () => ({ currency: 'USD', floor: -1 });
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload._fw_bidfloor).to.equal(0);
- expect(payload._fw_bidfloorcur).to.deep.equal('');
- });
-
- it('should add parameters to the tag', () => {
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload.reqType).to.equal('AdsSetup');
- expect(payload.protocolVersion).to.equal('4.2');
- expect(payload.zoneId).to.equal('277225');
- expect(payload.componentId).to.equal('prebid');
- expect(payload.componentSubId).to.equal('mustang');
- expect(payload.playerSize).to.equal('300x600');
- expect(payload.pbjs_version).to.equal(PREBID_VERSION);
- });
-
- it('should return a properly formatted request with schain defined', function () {
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload.schain).to.deep.equal('{\"ver\":\"1.0\",\"complete\":1,\"nodes\":[{\"asi\":\"example.com\",\"sid\":\"0\",\"hp\":1,\"rid\":\"bidrequestid\",\"domain\":\"example.com\"}]}');
- });
-
- it('sends bid request to ENDPOINT via GET', () => {
- const request = spec.buildRequests(bidRequests);
- expect(request[0].url).to.contain(ENDPOINT);
- expect(request[0].method).to.equal('GET');
- });
-
- it('should add usp consent to the request', () => {
- let uspConsentString = '1FW-SSP-uspConsent-';
- let bidderRequest = {};
- bidderRequest.uspConsent = uspConsentString;
- const request = spec.buildRequests(bidRequests, bidderRequest);
- const payload = request[0].data;
- expect(payload.reqType).to.equal('AdsSetup');
- expect(payload.protocolVersion).to.equal('4.2');
- expect(payload.zoneId).to.equal('277225');
- expect(payload.componentId).to.equal('prebid');
- expect(payload.componentSubId).to.equal('mustang');
- expect(payload.playerSize).to.equal('300x600');
- expect(payload._fw_us_privacy).to.exist.and.to.be.a('string');
- expect(payload._fw_us_privacy).to.equal(uspConsentString);
- });
-
- it('should add gdpr consent to the request', () => {
- let gdprConsentString = '1FW-SSP-gdprConsent-';
- let bidderRequest = {
- 'gdprConsent': {
- 'consentString': gdprConsentString
- },
- 'ortb2': {
- 'site': {
- 'content': {
- 'test': 'news',
- 'test2': 'param'
- }
- }
- }
- };
-
- const request = spec.buildRequests(bidRequests, bidderRequest);
- const payload = request[0].data;
- expect(payload.reqType).to.equal('AdsSetup');
- expect(payload.protocolVersion).to.equal('4.2');
- expect(payload.zoneId).to.equal('277225');
- expect(payload.componentId).to.equal('prebid');
- expect(payload.componentSubId).to.equal('mustang');
- expect(payload.playerSize).to.equal('300x600');
- expect(payload._fw_gdpr_consent).to.exist.and.to.be.a('string');
- expect(payload._fw_gdpr_consent).to.equal(gdprConsentString);
- expect(payload._fw_prebid_content).to.deep.equal('{\"test\":\"news\",\"test2\":\"param\"}');
-
- let gdprConsent = {
- 'gdprApplies': true,
- 'consentString': gdprConsentString
- }
- let syncOptions = {
- 'pixelEnabled': true
- }
- const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null, null);
- expect(userSyncs).to.deep.equal([{
- type: 'image',
- url: 'https://ads.stickyadstv.com/auto-user-sync?gdpr=1&gdpr_consent=1FW-SSP-gdprConsent-'
- }]);
- });
-
- it('should add gpp information to the request via bidderRequest.gppConsent', function () {
- let consentString = 'abc1234';
- let bidderRequest = {
- 'gppConsent': {
- 'gppString': consentString,
- 'applicableSections': [8]
- }
- };
-
- const request = spec.buildRequests(bidRequests, bidderRequest);
- const payload = request[0].data;
-
- expect(payload.gpp).to.equal(consentString);
- expect(payload.gpp_sid).to.deep.equal([8]);
-
- let gppConsent = {
- 'applicableSections': [8],
- 'gppString': consentString
- }
- let syncOptions = {
- 'pixelEnabled': true
- }
- const userSyncs = spec.getUserSyncs(syncOptions, null, null, null, gppConsent);
- expect(userSyncs).to.deep.equal([{
- type: 'image',
- url: 'https://ads.stickyadstv.com/auto-user-sync?gpp=abc1234&gpp_sid[]=8'
- }]);
- });
- })
-
- describe('buildRequestsForVideo', () => {
- let bidRequests = [
- {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'video': {
- 'playerSize': [300, 600],
- }
- },
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- }
- ];
-
- it('should return context and placement with default values', () => {
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload.video_context).to.equal(''); ;
- expect(payload.video_placement).to.equal(null);
- expect(payload.video_plcmt).to.equal(null);
- });
-
- it('should add parameters to the tag', () => {
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload.reqType).to.equal('AdsSetup');
- expect(payload.protocolVersion).to.equal('4.2');
- expect(payload.zoneId).to.equal('277225');
- expect(payload.componentId).to.equal('prebid');
- expect(payload.componentSubId).to.equal('mustang');
- expect(payload.playerSize).to.equal('300x600');
- });
-
- it('sends bid request to ENDPOINT via GET', () => {
- const request = spec.buildRequests(bidRequests);
- expect(request[0].url).to.contain(ENDPOINT);
- expect(request[0].method).to.equal('GET');
- });
-
- it('should add usp consent to the request', () => {
- let uspConsentString = '1FW-SSP-uspConsent-';
- let bidderRequest = {};
- bidderRequest.uspConsent = uspConsentString;
- const request = spec.buildRequests(bidRequests, bidderRequest);
- const payload = request[0].data;
- expect(payload.reqType).to.equal('AdsSetup');
- expect(payload.protocolVersion).to.equal('4.2');
- expect(payload.zoneId).to.equal('277225');
- expect(payload.componentId).to.equal('prebid');
- expect(payload.componentSubId).to.equal('mustang');
- expect(payload.playerSize).to.equal('300x600');
- expect(payload._fw_us_privacy).to.exist.and.to.be.a('string');
- expect(payload._fw_us_privacy).to.equal(uspConsentString);
- });
-
- it('should add gdpr consent to the request', () => {
- let gdprConsentString = '1FW-SSP-gdprConsent-';
- let bidderRequest = {
- 'gdprConsent': {
- 'consentString': gdprConsentString
- }
- };
-
- const request = spec.buildRequests(bidRequests, bidderRequest);
- const payload = request[0].data;
- expect(payload.reqType).to.equal('AdsSetup');
- expect(payload.protocolVersion).to.equal('4.2');
- expect(payload.zoneId).to.equal('277225');
- expect(payload.componentId).to.equal('prebid');
- expect(payload.componentSubId).to.equal('mustang');
- expect(payload.playerSize).to.equal('300x600');
- expect(payload._fw_gdpr_consent).to.exist.and.to.be.a('string');
- expect(payload._fw_gdpr_consent).to.equal(gdprConsentString);
-
- let gdprConsent = {
- 'gdprApplies': true,
- 'consentString': gdprConsentString
- }
- let syncOptions = {
- 'pixelEnabled': true
- }
- const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null, null);
- expect(userSyncs).to.deep.equal([{
- type: 'image',
- url: 'https://ads.stickyadstv.com/auto-user-sync?gdpr=1&gdpr_consent=1FW-SSP-gdprConsent-'
- }]);
- });
- })
-
- describe('buildRequestsForVideoWithContextAndPlacement', () => {
- let bidRequests = [
- {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'video': {
- 'context': 'outstream',
- 'placement': 2,
- 'plcmt': 3,
- 'playerSize': [300, 600],
- }
- },
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- }
- ];
-
- it('should return input context and placement', () => {
- const request = spec.buildRequests(bidRequests);
- const payload = request[0].data;
- expect(payload.video_context).to.equal('outstream'); ;
- expect(payload.video_placement).to.equal(2);
- expect(payload.video_plcmt).to.equal(3);
- });
- })
-
- describe('interpretResponseForBanner', () => {
- let bidRequests = [
- {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [
- [300, 250], [300, 600]
- ]
- }
- },
- 'sizes': [[300, 250], [300, 600]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- }
- ];
-
- let formattedBidRequests = [
- {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225',
- 'format': 'floorad'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [
- [300, 250], [300, 600]
- ]
- }
- },
- 'sizes': [[600, 250], [300, 600]],
- 'bidId': '30b3other1c1838de1e',
- 'bidderRequestId': '22edbae273other3bf6',
- 'auctionId': '1d1a03079test0a475',
- },
- {
- 'bidder': 'stickyadstv',
- 'params': {
- 'zoneId': '277225',
- 'format': 'test'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [
- [300, 600]
- ]
- }
- },
- 'sizes': [[300, 600]],
- 'bidId': '2',
- 'bidderRequestId': '3',
- 'auctionId': '4',
- }
- ];
-
- let response = '' +
- '' +
- ' ' +
- ' Adswizz' +
- ' ' +
- ' https://ads.stickyadstv.com/auto-user-sync?dealId=NRJ-PRO-12008' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' 00:00:09' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' 0.2000' +
- ' ' +
- ' ' +
- ' ' +
- '';
-
- let ad = '';
- let formattedAd = '';
-
- it('should get correct bid response', () => {
- var request = spec.buildRequests(bidRequests);
-
- let expectedResponse = [
- {
- requestId: '30b31c1838de1e',
- cpm: '0.2000',
- width: 300,
- height: 600,
- creativeId: '28517153',
- currency: 'EUR',
- netRevenue: true,
- ttl: 360,
- dealId: 'NRJ-PRO-00008',
- campaignId: 'SMF-WOW-55555',
- bannerId: '12345',
- ad: ad
- }
- ];
-
- let result = spec.interpretResponse(response, request[0]);
- expect(result[0].meta.advertiserDomains).to.deep.equal([]);
- expect(result[0].dealId).to.equal('NRJ-PRO-00008');
- expect(result[0].campaignId).to.equal('SMF-WOW-55555');
- expect(result[0].bannerId).to.equal('12345');
- });
-
- it('should get correct bid response with formated ad', () => {
- var request = spec.buildRequests(formattedBidRequests);
-
- let expectedResponse = [
- {
- requestId: '30b31c1838de1e',
- cpm: '0.2000',
- width: 300,
- height: 600,
- creativeId: '28517153',
- currency: 'EUR',
- netRevenue: true,
- ttl: 360,
- dealId: 'NRJ-PRO-00008',
- campaignId: 'SMF-WOW-55555',
- bannerId: '12345',
- ad: formattedAd
- }
- ];
-
- let result = spec.interpretResponse(response, request[0]);
- expect(result[0].meta.advertiserDomains).to.deep.equal([]);
- expect(result[0].dealId).to.equal('NRJ-PRO-00008');
- expect(result[0].campaignId).to.equal('SMF-WOW-55555');
- expect(result[0].bannerId).to.equal('12345');
- });
-
- it('handles nobid responses', () => {
- var request = spec.buildRequests(formattedBidRequests);
- let response = '';
-
- let result = spec.interpretResponse(response, request[0]);
- expect(result.length).to.equal(0);
- });
- });
-
- describe('interpretResponseForVideo', () => {
- let bidRequests = [
- {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'video': {
- 'playerSize': [300, 600],
- }
- },
- 'sizes': [[300, 400]],
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- }
- ];
-
- let formattedBidRequests = [
- {
- 'bidder': 'freewheel-ssp',
- 'params': {
- 'zoneId': '277225',
- 'format': 'floorad'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'video': {
- 'playerSize': [300, 600],
- }
- },
- 'sizes': [[300, 400]],
- 'bidId': '30b3other1c1838de1e',
- 'bidderRequestId': '22edbae273other3bf6',
- 'auctionId': '1d1a03079test0a475',
- },
- {
- 'bidder': 'stickyadstv',
- 'params': {
- 'zoneId': '277225',
- 'format': 'test'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'video': {
- 'playerSize': [300, 600],
- }
- },
- 'sizes': [[300, 400]],
- 'bidId': '2',
- 'bidderRequestId': '3',
- 'auctionId': '4',
- },
- {
- 'bidder': 'freewheelssp',
- 'params': {
- 'zoneId': '277225',
- 'format': 'test'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'video': {
- 'playerSize': [300, 600],
- }
- },
- 'sizes': [[300, 400]],
- 'bidId': '2',
- 'bidderRequestId': '3',
- 'auctionId': '4',
- }
- ];
-
- let response = '' +
- '' +
- ' ' +
- ' Adswizz' +
- ' ' +
- ' https://ads.stickyadstv.com/auto-user-sync?dealId=NRJ-PRO-00008' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' 00:00:09' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' 0.2000' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- '';
-
- let ad = '';
- let formattedAd = '';
-
- it('should get correct bid response', () => {
- var request = spec.buildRequests(bidRequests);
-
- let expectedResponse = [
- {
- requestId: '30b31c1838de1e',
- cpm: '0.2000',
- width: 300,
- height: 600,
- creativeId: '28517153',
- currency: 'EUR',
- netRevenue: true,
- ttl: 360,
- dealId: 'NRJ-PRO-00008',
- campaignId: 'SMF-WOW-55555',
- bannerId: '12345',
- vastXml: response,
- mediaType: 'video',
- ad: ad,
- meta: {
- advertiserDomains: 'minotaur.com'
- }
- }
- ];
-
- let result = spec.interpretResponse(response, request[0]);
- expect(result[0].meta.advertiserDomains).to.deep.equal(['minotaur.com']);
- expect(result[0].dealId).to.equal('NRJ-PRO-00008');
- expect(result[0].campaignId).to.equal('SMF-WOW-55555');
- expect(result[0].bannerId).to.equal('12345');
- });
-
- it('should get correct bid response with formated ad', () => {
- var request = spec.buildRequests(formattedBidRequests);
-
- let expectedResponse = [
- {
- requestId: '30b31c1838de1e',
- cpm: '0.2000',
- width: 300,
- height: 600,
- creativeId: '28517153',
- currency: 'EUR',
- netRevenue: true,
- ttl: 360,
- dealId: 'NRJ-PRO-00008',
- campaignId: 'SMF-WOW-55555',
- bannerId: '12345',
- vastXml: response,
- mediaType: 'video',
- ad: formattedAd
- }
- ];
-
- let result = spec.interpretResponse(response, request[0]);
- expect(result[0].meta.advertiserDomains).to.deep.equal(['minotaur.com']);
- expect(result[0].dealId).to.equal('NRJ-PRO-00008');
- expect(result[0].campaignId).to.equal('SMF-WOW-55555');
- expect(result[0].bannerId).to.equal('12345');
- });
-
- it('handles nobid responses', () => {
- var request = spec.buildRequests(formattedBidRequests);
- let response = '';
-
- let result = spec.interpretResponse(response, request[0]);
- expect(result.length).to.equal(0);
- });
- });
-});