diff --git a/modules/richaudienceBidAdapter.js b/modules/richaudienceBidAdapter.js
deleted file mode 100755
index 6ee9b016967..00000000000
--- a/modules/richaudienceBidAdapter.js
+++ /dev/null
@@ -1,381 +0,0 @@
-import {deepAccess, isStr, triggerPixel} from '../src/utils.js';
-import {registerBidder} from '../src/adapters/bidderFactory.js';
-import {config} from '../src/config.js';
-import {BANNER, VIDEO} from '../src/mediaTypes.js';
-import {Renderer} from '../src/Renderer.js';
-import {getAllOrtbKeywords} from '../libraries/keywords/keywords.js';
-
-const BIDDER_CODE = 'richaudience';
-let REFERER = '';
-
-export const spec = {
- code: BIDDER_CODE,
- gvlid: 108,
- aliases: ['ra'],
- supportedMediaTypes: [BANNER, VIDEO],
-
- /***
- * Determines whether or not the given bid request is valid
- *
- * @param {bidRequest} bid The bid params to validate.
- * @returns {boolean} True if this is a valid bid, and false otherwise
- */
- isBidRequestValid: function (bid) {
- return !!(bid.params && bid.params.pid && bid.params.supplyType);
- },
- /***
- * Build a server request from the list of valid BidRequests
- * @param {validBidRequests} is an array of the valid bids
- * @param {bidderRequest} bidder request object
- * @returns {ServerRequest} Info describing the request to the server
- */
- buildRequests: function (validBidRequests, bidderRequest) {
- return validBidRequests.map(bid => {
- var payload = {
- bidfloor: raiGetFloor(bid, config),
- ifa: bid.params.ifa,
- pid: bid.params.pid,
- supplyType: bid.params.supplyType,
- currencyCode: config.getConfig('currency.adServerCurrency'),
- // TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
- auctionId: bid.auctionId,
- bidId: bid.bidId,
- BidRequestsCount: bid.bidRequestsCount,
- bidder: bid.bidder,
- bidderRequestId: bid.bidderRequestId,
- tagId: bid.adUnitCode,
- sizes: raiGetSizes(bid),
- // TODO: is 'page' the right value here?
- referer: (typeof bidderRequest.refererInfo.page != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.page) : null),
- numIframes: (typeof bidderRequest.refererInfo.numIframes != 'undefined' ? bidderRequest.refererInfo.numIframes : null),
- transactionId: bid.ortb2Imp?.ext?.tid,
- timeout: bidderRequest.timeout || 600,
- user: raiSetEids(bid),
- demand: raiGetDemandType(bid),
- videoData: raiGetVideoInfo(bid),
- scr_rsl: raiGetResolution(),
- cpuc: (typeof window.navigator != 'undefined' ? window.navigator.hardwareConcurrency : null),
- kws: getAllOrtbKeywords(bidderRequest.ortb2, bid.params.keywords).join(','),
- schain: bid.schain,
- gpid: raiSetPbAdSlot(bid)
- };
-
- // TODO: is 'page' the right value here?
- REFERER = (typeof bidderRequest.refererInfo.page != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.page) : null)
-
- payload.gdpr_consent = '';
- payload.gdpr = false;
-
- if (bidderRequest && bidderRequest.gdprConsent) {
- if (typeof bidderRequest.gdprConsent.gdprApplies != 'undefined') {
- payload.gdpr = bidderRequest.gdprConsent.gdprApplies;
- }
- if (typeof bidderRequest.gdprConsent.consentString != 'undefined') {
- payload.gdpr_consent = bidderRequest.gdprConsent.consentString;
- }
- }
-
- if (bidderRequest?.gppConsent) {
- payload.privacy = {
- gpp: bidderRequest.gppConsent.gppString,
- gpp_sid: bidderRequest.gppConsent.applicableSections
- }
- } else if (bidderRequest?.ortb2?.regs?.gpp) {
- payload.privacy = {
- gpp: bidderRequest.ortb2.regs.gpp,
- gpp_sid: bidderRequest.ortb2.regs.gpp_sid
- }
- }
-
- var payloadString = JSON.stringify(payload);
-
- var endpoint = 'https://shb.richaudience.com/hb/';
-
- return {
- method: 'POST',
- url: endpoint,
- data: payloadString,
- };
- });
- },
- /***
- * Read the response from the server and build a list of bids
- * @param {serverResponse} Response from the server.
- * @param {bidRequest} Bid request object
- * @returns {bidResponses} Array of bids which were nested inside the server
- */
- interpretResponse: function (serverResponse, bidRequest) {
- const bidResponses = [];
- // try catch
- var response = serverResponse.body;
- if (response) {
- var bidResponse = {
- requestId: JSON.parse(bidRequest.data).bidId,
- cpm: response.cpm,
- width: response.width,
- height: response.height,
- creativeId: response.creative_id,
- mediaType: response.media_type,
- netRevenue: response.netRevenue,
- currency: response.currency,
- ttl: response.ttl,
- meta: response.adomain,
- dealId: response.dealId
- };
-
- if (response.media_type === 'video') {
- bidResponse.vastXml = response.vastXML;
- try {
- if (bidResponse.vastXml != null) {
- if (JSON.parse(bidRequest.data).videoData.format == 'outstream' || JSON.parse(bidRequest.data).videoData.format == 'banner') {
- bidResponse.renderer = Renderer.install({
- id: bidRequest.bidId,
- adunitcode: bidRequest.tagId,
- loaded: false,
- config: response.media_type,
- url: 'https://cdn3.richaudience.com/prebidVideo/player.js'
- });
- }
- bidResponse.renderer.setRender(renderer);
- }
- } catch (e) {
- bidResponse.ad = response.adm;
- }
- } else {
- bidResponse.ad = response.adm;
- }
-
- bidResponses.push(bidResponse);
- }
- return bidResponses;
- },
- /***
- * User Syncs
- *
- * @param {syncOptions} Publisher prebid configuration
- * @param {serverResponses} Response from the server
- * @param {gdprConsent} GPDR consent object
- * @returns {Array}
- */
- getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent, gppConsent) {
- const syncs = [];
-
- var rand = Math.floor(Math.random() * 9999999999);
- var syncUrl = '';
- var consent = '';
- var consentGPP = '';
-
- var raiSync = {};
-
- raiSync = raiGetSyncInclude(config);
-
- if (gdprConsent && typeof gdprConsent.consentString === 'string' && typeof gdprConsent.consentString != 'undefined') {
- consent = `consentString=${gdprConsent.consentString}`
- }
-
- // GPP Consent
- if (gppConsent?.gppString && gppConsent?.applicableSections?.length) {
- consentGPP = 'gpp=' + encodeURIComponent(gppConsent.gppString);
- consentGPP += '&gpp_sid=' + encodeURIComponent(gppConsent?.applicableSections?.join(','));
- }
-
- if (syncOptions.iframeEnabled && raiSync.raiIframe != 'exclude') {
- syncUrl = 'https://sync.richaudience.com/dcf3528a0b8aa83634892d50e91c306e/?ord=' + rand
- if (consent != '') {
- syncUrl += `&${consent}`
- }
- if (consentGPP != '') {
- syncUrl += `&${consentGPP}`
- }
- syncs.push({
- type: 'iframe',
- url: syncUrl
- });
- }
-
- if (syncOptions.pixelEnabled && REFERER != null && syncs.length == 0 && raiSync.raiImage != 'exclude') {
- syncUrl = `https://sync.richaudience.com/bf7c142f4339da0278e83698a02b0854/?referrer=${REFERER}`;
- if (consent != '') {
- syncUrl += `&${consent}`
- }
- if (consentGPP != '') {
- syncUrl += `&${consentGPP}`
- }
- syncs.push({
- type: 'image',
- url: syncUrl
- });
- }
- return syncs
- },
-
- onTimeout: function (data) {
- let url = raiGetTimeoutURL(data);
- if (url) {
- triggerPixel(url);
- }
- }
-};
-
-registerBidder(spec);
-
-function raiGetSizes(bid) {
- let raiNewSizes;
- if (bid.mediaTypes && bid.mediaTypes.banner && bid.mediaTypes.banner.sizes) {
- raiNewSizes = bid.mediaTypes.banner.sizes
- }
- if (raiNewSizes != null) {
- return raiNewSizes.map(size => ({
- w: size[0],
- h: size[1]
- }));
- }
-}
-
-function raiGetDemandType(bid) {
- let raiFormat = 'display';
- if (typeof bid.sizes != 'undefined') {
- bid.sizes.forEach(function (sz) {
- if ((sz[0] == '1800' && sz[1] == '1000') || (sz[0] == '1' && sz[1] == '1')) {
- raiFormat = 'skin'
- }
- })
- }
- if (bid.mediaTypes != undefined) {
- if (bid.mediaTypes.video != undefined) {
- raiFormat = 'video';
- }
- }
- return raiFormat;
-}
-
-function raiGetVideoInfo(bid) {
- let videoData;
- if (raiGetDemandType(bid) == 'video') {
- videoData = {
- format: bid.mediaTypes.video.context,
- playerSize: bid.mediaTypes.video.playerSize,
- mimes: bid.mediaTypes.video.mimes
- };
- } else {
- videoData = {
- format: 'banner'
- }
- }
- return videoData;
-}
-
-function raiSetEids(bid) {
- let eids = [];
-
- if (bid && bid.userId) {
- raiSetUserId(bid, eids, 'id5-sync.com', deepAccess(bid, `userId.id5id.uid`));
- raiSetUserId(bid, eids, 'pubcommon', deepAccess(bid, `userId.pubcid`));
- raiSetUserId(bid, eids, 'criteo.com', deepAccess(bid, `userId.criteoId`));
- raiSetUserId(bid, eids, 'liveramp.com', deepAccess(bid, `userId.idl_env`));
- raiSetUserId(bid, eids, 'liveintent.com', deepAccess(bid, `userId.lipb.lipbid`));
- raiSetUserId(bid, eids, 'adserver.org', deepAccess(bid, `userId.tdid`));
- }
-
- return eids;
-}
-
-function raiSetUserId(bid, eids, source, value) {
- if (isStr(value)) {
- eids.push({
- userId: value,
- source: source
- });
- }
-}
-
-function renderer(bid) {
- bid.renderer.push(() => {
- renderAd(bid)
- });
-}
-
-function renderAd(bid) {
- let raOutstreamHBPassback = `${bid.vastXml}`;
- let raPlayerHB = {
- config: bid.params[0].player != undefined ? {
- end: bid.params[0].player.end != null ? bid.params[0].player.end : 'close',
- init: bid.params[0].player.init != null ? bid.params[0].player.init : 'close',
- skin: bid.params[0].player.skin != null ? bid.params[0].player.skin : 'light',
- } : {end: 'close', init: 'close', skin: 'light'},
- pid: bid.params[0].pid,
- adUnit: bid.adUnitCode
- };
-
- window.raParams(raPlayerHB, raOutstreamHBPassback, true);
-}
-
-function raiGetResolution() {
- let resolution = '';
- if (typeof window.screen != 'undefined') {
- resolution = window.screen.width + 'x' + window.screen.height;
- }
- return resolution;
-}
-
-function raiSetPbAdSlot(bid) {
- let pbAdSlot = '';
- if (deepAccess(bid, 'ortb2Imp.ext.data.gpid') != null) {
- pbAdSlot = deepAccess(bid, 'ortb2Imp.ext.data.gpid')
- }
- if (deepAccess(bid, 'ortb2Imp.ext.data.pbadslot') != null) {
- pbAdSlot = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot')
- }
- return pbAdSlot
-}
-
-function raiGetSyncInclude(config) {
- try {
- let raConfig = null;
- let raiSync = {};
- if (config.getConfig('userSync').filterSettings != null && typeof config.getConfig('userSync').filterSettings != 'undefined') {
- raConfig = config.getConfig('userSync').filterSettings
- if (raConfig.iframe != null && typeof raConfig.iframe != 'undefined') {
- raiSync.raiIframe = raConfig.iframe.bidders == 'richaudience' || raConfig.iframe.bidders == '*' ? raConfig.iframe.filter : 'exclude';
- }
- if (raConfig.image != null && typeof raConfig.image != 'undefined') {
- raiSync.raiImage = raConfig.image.bidders == 'richaudience' || raConfig.image.bidders == '*' ? raConfig.image.filter : 'exclude';
- }
- }
- return raiSync;
- } catch (e) {
- return null;
- }
-}
-
-function raiGetFloor(bid, config) {
- try {
- let raiFloor;
- if (bid.params.bidfloor != null) {
- raiFloor = bid.params.bidfloor;
- } else if (typeof bid.getFloor == 'function') {
- let floorSpec = bid.getFloor({
- currency: config.getConfig('floors.data.currency') != null ? config.getConfig('floors.data.currency') : 'USD',
- mediaType: typeof bid.mediaTypes['banner'] == 'object' ? 'banner' : 'video',
- size: '*'
- })
-
- raiFloor = floorSpec.floor;
- }
- return raiFloor
- } catch (e) {
- return 0
- }
-}
-
-function raiGetTimeoutURL(data) {
- let {params, timeout} = data[0]
- let url = 'https://s.richaudience.com/err/?ec=6&ev=[timeout_publisher]&pla=[placement_hash]&int=PREBID&pltfm=&node=&dm=[domain]';
-
- url = url.replace('[timeout_publisher]', timeout)
- url = url.replace('[placement_hash]', params[0].pid)
- if (document.location.host != null) {
- url = url.replace('[domain]', document.location.host)
- }
- return url
-}
diff --git a/test/spec/modules/richaudienceBidAdapter_spec.js b/test/spec/modules/richaudienceBidAdapter_spec.js
deleted file mode 100644
index d2b173f53df..00000000000
--- a/test/spec/modules/richaudienceBidAdapter_spec.js
+++ /dev/null
@@ -1,1304 +0,0 @@
-// import or require modules necessary for the test, e.g.:
-import {expect} from 'chai'; // may prefer 'assert' in place of 'expect'
-import {
- spec
-} from 'modules/richaudienceBidAdapter.js';
-import {config} from 'src/config.js';
-import * as utils from 'src/utils.js';
-import sinon from 'sinon';
-
-describe('Richaudience adapter tests', function () {
- var DEFAULT_PARAMS_NEW_SIZES = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250], [300, 600], [728, 90], [970, 250]]
- }
- },
- bidder: 'richaudience',
- params: {
- bidfloor: 0.5,
- pid: 'ADb1f40rmi',
- supplyType: 'site',
- keywords: 'key1=value1;key2=value2'
- },
- auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- ortb2Imp: {
- ext: {
- tid: '29df2112-348b-4961-8863-1b33684d95e6',
- }
- },
- user: {}
- }];
-
- var DEFAULT_PARAMS_NEW_SIZES_GPID = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- ortb2Imp: {
- ext: {
- gpid: '/19968336/header-bid-tag-1#example-2',
- data: {
- pbadslot: '/19968336/header-bid-tag-1#example-2'
- }
- }
- },
- mediaTypes: {
- banner: {
- sizes: [
- [300, 250], [300, 600], [728, 90], [970, 250]]
- }
- },
- bidder: 'richaudience',
- params: {
- bidfloor: 0.5,
- pid: 'ADb1f40rmi',
- supplyType: 'site',
- keywords: 'key1=value1;key2=value2'
- },
- auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
- user: {}
- }];
-
- var DEFAULT_PARAMS_VIDEO_TIMEOUT = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480],
- mimes: ['video/mp4']
- }
- },
- bidder: 'richaudience',
- params: [{
- bidfloor: 0.5,
- pid: 'ADb1f40rmi',
- supplyType: 'site'
- }],
- timeout: 3000,
- auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
- user: {}
- }]
-
- var DEFAULT_PARAMS_VIDEO_IN = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- mediaTypes: {
- video: {
- context: 'instream',
- playerSize: [640, 480],
- mimes: ['video/mp4']
- }
- },
- bidder: 'richaudience',
- params: {
- bidfloor: 0.5,
- pid: 'ADb1f40rmi',
- supplyType: 'site'
- },
- auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
- user: {}
- }];
-
- var DEFAULT_PARAMS_VIDEO_OUT = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- mediaTypes: {
- video: {
- context: 'outstream',
- playerSize: [640, 480],
- mimes: ['video/mp4']
- }
- },
- bidder: 'richaudience',
- params: {
- bidfloor: 0.5,
- pid: 'ADb1f40rmi',
- supplyType: 'site'
- },
- auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
- user: {}
- }];
-
- var DEFAULT_PARAMS_BANNER_OUTSTREAM = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [600, 300]]
- }
- },
- bidder: 'richaudience',
- params: {
- bidfloor: 0.5,
- pid: 'ADb1f40rmi',
- supplyType: 'site'
- },
- auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
- user: {}
- }];
-
- var DEFAULT_PARAMS_APP = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- sizes: [
- [300, 250],
- [300, 600],
- [728, 90],
- [970, 250]
- ],
- bidder: 'richaudience',
- params: {
- bidfloor: 0.5,
- ifa: 'AAAAAAAAA-BBBB-CCCC-1111-222222220000',
- pid: 'ADb1f40rmi',
- supplyType: 'app',
- },
- auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6'
- }];
-
- var DEFAULT_PARAMS_WO_OPTIONAL = [{
- adUnitCode: 'test-div',
- bidId: '2c7c8e9c900244',
- sizes: [
- [300, 250],
- [300, 600],
- [728, 90],
- [970, 250]
- ],
- bidder: 'richaudience',
- params: {
- pid: 'ADb1f40rmi',
- supplyType: 'site',
- },
- auctionId: '851adee7-d843-48f9-a7e9-9ff00573fcbf',
- bidRequestsCount: 1,
- bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6'
- }];
-
- var BID_RESPONSE = {
- body: {
- cpm: 1.50,
- adm: '',
- media_type: 'js',
- width: 300,
- height: 250,
- creative_id: '189198063',
- netRevenue: true,
- currency: 'USD',
- ttl: 300,
- dealId: 'dealId',
- adomain: 'richaudience.com'
- }
- };
-
- var BID_RESPONSE_VIDEO = {
- body: {
- cpm: 1.50,
- media_type: 'video',
- width: 1,
- height: 1,
- creative_id: '189198063',
- netRevenue: true,
- currency: 'USD',
- ttl: 300,
- vastXML: '',
- dealId: 'dealId',
- adomain: 'richaudience.com'
- }
- };
-
- var DEFAULT_PARAMS_GDPR = {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'http://domain.com',
- numIframes: 0
- }
- }
-
- it('Referer undefined', function() {
- config.setConfig({
- 'currency': {'adServerCurrency': 'USD'}
- })
-
- const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {}
- })
- const requestContent = JSON.parse(request[0].data);
- expect(requestContent).to.have.property('referer').and.to.equal(null);
- expect(requestContent).to.have.property('referer').and.to.equal(null);
- })
-
- it('Verify build request to prebid 3.0 display test', function() {
- const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
-
- expect(request[0]).to.have.property('method').and.to.equal('POST');
- const requestContent = JSON.parse(request[0].data);
- expect(requestContent).to.have.property('bidfloor').and.to.equal(0.5);
- expect(requestContent).to.have.property('pid').and.to.equal('ADb1f40rmi');
- expect(requestContent).to.have.property('supplyType').and.to.equal('site');
- expect(requestContent).to.have.property('auctionId').and.to.equal('0cb3144c-d084-4686-b0d6-f5dbe917c563');
- expect(requestContent).to.have.property('bidId').and.to.equal('2c7c8e9c900244');
- expect(requestContent).to.have.property('BidRequestsCount').and.to.equal(1);
- expect(requestContent).to.have.property('bidder').and.to.equal('richaudience');
- expect(requestContent).to.have.property('bidderRequestId').and.to.equal('1858b7382993ca');
- expect(requestContent).to.have.property('tagId').and.to.equal('test-div');
- expect(requestContent).to.have.property('referer').and.to.equal('https%3A%2F%2Fdomain.com');
- expect(requestContent).to.have.property('sizes');
- expect(requestContent.sizes[0]).to.have.property('w').and.to.equal(300);
- expect(requestContent.sizes[0]).to.have.property('h').and.to.equal(250);
- expect(requestContent.sizes[1]).to.have.property('w').and.to.equal(300);
- expect(requestContent.sizes[1]).to.have.property('h').and.to.equal(600);
- expect(requestContent.sizes[2]).to.have.property('w').and.to.equal(728);
- expect(requestContent.sizes[2]).to.have.property('h').and.to.equal(90);
- expect(requestContent.sizes[3]).to.have.property('w').and.to.equal(970);
- expect(requestContent.sizes[3]).to.have.property('h').and.to.equal(250);
- expect(requestContent).to.have.property('transactionId').and.to.equal('29df2112-348b-4961-8863-1b33684d95e6');
- expect(requestContent).to.have.property('timeout').and.to.equal(600);
- expect(requestContent).to.have.property('numIframes').and.to.equal(0);
- expect(typeof requestContent.scr_rsl === 'string')
- expect(typeof requestContent.cpuc === 'number')
- expect(typeof requestContent.gpid === 'string')
- expect(requestContent).to.have.property('kws').and.to.equal('key1=value1;key2=value2');
- })
-
- it('Verify build request to prebid video inestream', function() {
- const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_IN, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
-
- expect(request[0]).to.have.property('method').and.to.equal('POST');
- const requestContent = JSON.parse(request[0].data);
-
- expect(requestContent).to.have.property('demand').and.to.equal('video');
- expect(requestContent.videoData).to.have.property('format').and.to.equal('instream');
- })
-
- it('Verify build request to prebid video outstream', function() {
- const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_OUT, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
-
- expect(request[0]).to.have.property('method').and.to.equal('POST');
- const requestContent = JSON.parse(request[0].data);
-
- expect(requestContent).to.have.property('demand').and.to.equal('video');
- expect(requestContent.videoData).to.have.property('format').and.to.equal('outstream');
- })
-
- describe('gdpr test', function () {
- it('Verify build request with GDPR', function () {
- config.setConfig({
- 'currency': {
- 'adServerCurrency': 'USD'
- },
- consentManagement: {
- cmpApi: 'iab',
- timeout: 8000,
- allowAuctionWithoutConsent: true
- }
- });
-
- const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
- const requestContent = JSON.parse(request[0].data);
- expect(requestContent).to.have.property('gdpr_consent').and.to.equal('BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA');
- });
-
- it('Verify adding ifa when supplyType equal to app', function () {
- const request = spec.buildRequests(DEFAULT_PARAMS_APP, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
- });
-
- it('Verify build request with GDPR without gdprApplies', function () {
- config.setConfig({
- 'currency': {
- 'adServerCurrency': 'EUR'
- },
- consentManagement: {
- cmp: 'iab',
- consentRequired: true,
- timeout: 8000,
- allowAuctionWithoutConsent: true
- }
- });
- const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA'
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
- const requestContent = JSON.parse(request[0].data);
- expect(requestContent).to.have.property('gdpr_consent').and.to.equal('BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA');
- });
- });
-
- describe('UID test', function () {
- config.setConfig({
- consentManagement: {
- cmpApi: 'iab',
- timeout: 5000,
- allowAuctionWithoutConsent: true
- },
- userSync: {
- userIds: [{
- name: 'id5Id',
- params: {
- partner: 173, // change to the Partner Number you received from ID5
- pd: 'MT1iNTBjY...' // optional, see table below for a link to how to generate this
- },
- storage: {
- type: 'html5', // "html5" is the required storage type
- name: 'id5id', // "id5id" is the required storage name
- expires: 90, // storage lasts for 90 days
- refreshInSeconds: 8 * 3600 // refresh ID every 8 hours to ensure it's fresh
- }
- }],
- auctionDelay: 50 // 50ms maximum auction delay, applies to all userId modules
- }
- });
- it('Verify build id5', function () {
- var request;
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = { uid: 1 };
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
-
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = { uid: [] };
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = { uid: null };
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = { uid: {} };
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = null;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = {};
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
- });
-
- it('Verify build pubCommonId', function () {
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = 'pub_common_user_id';
-
- var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
-
- expect(requestContent.user).to.deep.equal([{
- 'userId': 'pub_common_user_id',
- 'source': 'pubcommon'
- }]);
-
- var request;
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = 1;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = [];
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = null;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = {};
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
- });
-
- it('Verify build criteoId', function () {
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = 'criteo-user-id';
-
- var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
-
- expect(requestContent.user).to.deep.equal([{
- 'userId': 'criteo-user-id',
- 'source': 'criteo.com'
- }]);
-
- var request;
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = 1;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = null;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = {};
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
- });
-
- it('Verify build identityLink', function () {
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 'identity-link-user-id';
-
- var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
-
- expect(requestContent.user).to.deep.equal([{
- 'userId': 'identity-link-user-id',
- 'source': 'liveramp.com'
- }]);
-
- var request;
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 1;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = null;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = {};
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
- });
- it('Verify build liveIntentId', function () {
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 'identity-link-user-id';
-
- var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data)
-
- expect(requestContent.user).to.deep.equal([{
- 'userId': 'identity-link-user-id',
- 'source': 'liveramp.com'
- }]);
-
- var request;
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 1;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = null;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = {};
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
- });
- it('Verify build TradeDesk', function () {
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.tdid = 'tdid-user-id';
-
- var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- var requestContent = JSON.parse(request[0].data)
-
- expect(requestContent.user).to.deep.equal([{
- 'userId': 'tdid-user-id',
- 'source': 'adserver.org'
- }]);
-
- request;
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 1;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = null;
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
-
- DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = {};
- request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
- requestContent = JSON.parse(request[0].data);
- expect(requestContent.user.eids).to.equal(undefined);
- });
- });
-
- it('Verify interprete response', function () {
- const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
-
- const bids = spec.interpretResponse(BID_RESPONSE, request[0]);
- expect(bids).to.have.lengthOf(1);
- const bid = bids[0];
- expect(bid.cpm).to.equal(1.50);
- expect(bid.ad).to.equal('');
- expect(bid.mediaType).to.equal('js');
- expect(bid.width).to.equal(300);
- expect(bid.height).to.equal(250);
- expect(bid.creativeId).to.equal('189198063');
- expect(bid.netRevenue).to.equal(true);
- expect(bid.currency).to.equal('USD');
- expect(bid.ttl).to.equal(300);
- expect(bid.dealId).to.equal('dealId');
- expect(bid.meta).to.equal('richaudience.com');
- });
-
- it('no banner media response inestream', function () {
- const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_IN, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
-
- const bids = spec.interpretResponse(BID_RESPONSE_VIDEO, request[0]);
- expect(bids).to.have.lengthOf(1);
- const bid = bids[0];
- expect(bid.cpm).to.equal(1.50);
- expect(bid.mediaType).to.equal('video');
- expect(bid.vastXml).to.equal('');
- expect(bid.cpm).to.equal(1.50);
- expect(bid.width).to.equal(1);
- expect(bid.height).to.equal(1);
- expect(bid.creativeId).to.equal('189198063');
- expect(bid.netRevenue).to.equal(true);
- expect(bid.currency).to.equal('USD');
- expect(bid.ttl).to.equal(300);
- expect(bid.dealId).to.equal('dealId');
- expect(bid.meta).to.equal('richaudience.com');
- });
-
- it('no banner media response outstream', function () {
- const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_OUT, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
-
- const bids = spec.interpretResponse(BID_RESPONSE_VIDEO, request[0]);
- expect(bids).to.have.lengthOf(1);
- const bid = bids[0];
- expect(bid.cpm).to.equal(1.50);
- expect(bid.mediaType).to.equal('video');
- expect(bid.vastXml).to.equal('');
- expect(bid.renderer.url).to.equal('https://cdn3.richaudience.com/prebidVideo/player.js');
- expect(bid.cpm).to.equal(1.50);
- expect(bid.width).to.equal(1);
- expect(bid.height).to.equal(1);
- expect(bid.creativeId).to.equal('189198063');
- expect(bid.netRevenue).to.equal(true);
- expect(bid.currency).to.equal('USD');
- expect(bid.ttl).to.equal(300);
- expect(bid.dealId).to.equal('dealId');
- });
-
- it('banner media and response VAST', function () {
- const request = spec.buildRequests(DEFAULT_PARAMS_BANNER_OUTSTREAM, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- page: 'https://domain.com',
- numIframes: 0
- }
- });
-
- const bids = spec.interpretResponse(BID_RESPONSE_VIDEO, request[0]);
- const bid = bids[0];
- expect(bid.mediaType).to.equal('video');
- expect(bid.vastXml).to.equal('');
- expect(bid.renderer.url).to.equal('https://cdn3.richaudience.com/prebidVideo/player.js');
- });
-
- it('Verifies bidder_code', function () {
- expect(spec.code).to.equal('richaudience');
- });
-
- it('Verifies bidder aliases', function () {
- expect(spec.aliases).to.have.lengthOf(1);
- expect(spec.aliases[0]).to.equal('ra');
- });
-
- it('Verifies bidder gvlid', function () {
- expect(spec.gvlid).to.equal(108);
- });
-
- it('Verifies bidder supportedMediaTypes', function () {
- expect(spec.supportedMediaTypes).to.have.lengthOf(2);
- expect(spec.supportedMediaTypes[0]).to.equal('banner');
- expect(spec.supportedMediaTypes[1]).to.equal('video');
- });
-
- it('Verifies if bid request is valid', function () {
- expect(spec.isBidRequestValid(DEFAULT_PARAMS_NEW_SIZES[0])).to.equal(true);
- expect(spec.isBidRequestValid(DEFAULT_PARAMS_WO_OPTIONAL[0])).to.equal(true);
- expect(spec.isBidRequestValid({})).to.equal(false);
- expect(spec.isBidRequestValid({
- params: {}
- })).to.equal(false);
- expect(spec.isBidRequestValid({
- params: {
- pid: 'ADb1f40rmi'
- }
- })).to.equal(false);
- expect(spec.isBidRequestValid({
- params: {
- supplyType: 'site'
- }
- })).to.equal(false);
- expect(spec.isBidRequestValid({
- params: {
- supplyType: 'app'
- }
- })).to.equal(false);
- expect(spec.isBidRequestValid({
- params: {
- pid: 'ADb1f40rmi',
- supplyType: 'site'
- }
- })).to.equal(true);
- expect(spec.isBidRequestValid({
- params: {
- pid: ['1gCB5ZC4XL', '1a40xk8qSV'],
- supplyType: 'site'
- }
- })).to.equal(true);
- expect(spec.isBidRequestValid({
- params: {
- pid: 'ADb1f40rmi',
- supplyType: 'site'
- }
- })).to.equal(true);
- expect(spec.isBidRequestValid({
- params: {
- pid: 'ADb1f40rmi',
- supplyType: 'app',
- ifa: 'AAAAAAAAA-BBBB-CCCC-1111-222222220000',
- }
- })).to.equal(true);
- expect(spec.isBidRequestValid({
- params: {
- pid: 'ADb1f40rmi',
- supplyType: 'site',
- bidfloor: 0.50,
- }
- })).to.equal(true);
- expect(spec.isBidRequestValid({
- params: {
- pid: 'ADb1f40rmi',
- supplyType: 'site',
- bidfloor: 0.50,
- }
- })).to.equal(true);
- expect(spec.isBidRequestValid({
- params: {
- pid: ['1gCB5ZC4XL', '1a40xk8qSV'],
- bidfloor: 0.50,
- }
- })).to.equal(false);
- expect(spec.isBidRequestValid({
- params: {
- pid: ['1gCB5ZC4XL', '1a40xk8qSV'],
- supplyType: 'site',
- bidfloor: 0.50,
- }
- })).to.equal(true);
- expect(spec.isBidRequestValid({
- params: {
- supplyType: 'site',
- bidfloor: 0.50,
- ifa: 'AAAAAAAAA-BBBB-CCCC-1111-222222220000',
- }
- })).to.equal(false);
- expect(spec.isBidRequestValid({
- params: {
- pid: ['1gCB5ZC4XL', '1a40xk8qSV'],
- supplyType: 'site',
- bidfloor: 0.50,
- ifa: 'AAAAAAAAA-BBBB-CCCC-1111-222222220000',
- }
- })).to.equal(true);
- });
-
- it('should pass schain', function() {
- let schain = {
- 'ver': '1.0',
- 'complete': 1,
- 'nodes': [{
- 'asi': 'richaudience.com',
- 'sid': '00001',
- 'hp': 1
- }, {
- 'asi': 'richaudience-2.com',
- 'sid': '00002',
- 'hp': 1
- }]
- }
-
- DEFAULT_PARAMS_NEW_SIZES[0].schain = {
- 'ver': '1.0',
- 'complete': 1,
- 'nodes': [{
- 'asi': 'richaudience.com',
- 'sid': '00001',
- 'hp': 1
- }, {
- 'asi': 'richaudience-2.com',
- 'sid': '00002',
- 'hp': 1
- }]
- }
-
- const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {}
- })
- const requestContent = JSON.parse(request[0].data);
- expect(requestContent).to.have.property('schain').to.deep.equal(schain);
- })
-
- it('should pass gpid', function() {
- const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES_GPID, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {}
- })
- const requestContent = JSON.parse(request[0].data);
- expect(requestContent).to.have.property('gpid').and.to.equal('/19968336/header-bid-tag-1#example-2');
- })
-
- describe('onTimeout', function () {
- beforeEach(function() {
- sinon.stub(utils, 'triggerPixel');
- });
-
- afterEach(function() {
- utils.triggerPixel.restore();
- });
- it('onTimeout exist as a function', () => {
- expect(spec.onTimeout).to.exist.and.to.be.a('function');
- });
- it('should send timeouts', function () {
- spec.onTimeout(DEFAULT_PARAMS_VIDEO_TIMEOUT);
- expect(utils.triggerPixel.called).to.equal(true);
- expect(utils.triggerPixel.firstCall.args[0]).to.equal('https://s.richaudience.com/err/?ec=6&ev=3000&pla=ADb1f40rmi&int=PREBID&pltfm=&node=&dm=localhost:9876');
- });
- });
-
- describe('userSync', function () {
- let sandbox;
- beforeEach(function () {
- sandbox = sinon.sandbox.create();
- });
- afterEach(function() {
- sandbox.restore();
- });
- it('Verifies user syncs iframe include', function () {
- config.setConfig({
- 'userSync': {filterSettings: {iframe: {bidders: '*', filter: 'include'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true},
- );
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('iframe');
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true,
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: true,
- }, [], {consentString: '', gdprApplies: false});
- expect(syncs).to.have.lengthOf(1);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- }, [], {consentString: '', gdprApplies: true});
- expect(syncs).to.have.lengthOf(0);
- });
- it('Verifies user syncs iframe exclude', function () {
- config.setConfig({
- 'userSync': {filterSettings: {iframe: {bidders: '*', filter: 'exclude'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true},
- );
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true,
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: true,
- }, [], {consentString: '', gdprApplies: false});
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- }, [], {consentString: '', gdprApplies: true});
- expect(syncs).to.have.lengthOf(0);
- });
-
- it('Verifies user syncs image include', function () {
- config.setConfig({
- 'userSync': {filterSettings: {image: {bidders: '*', filter: 'include'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- referer: 'http://domain.com',
- gdprApplies: true
- })
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('image');
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: '',
- referer: 'http://domain.com',
- gdprApplies: true
- })
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('image');
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: true
- }, [], {
- consentString: null,
- referer: 'http://domain.com',
- gdprApplies: false
- })
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('image');
- });
-
- it('Verifies user syncs image exclude', function () {
- config.setConfig({
- 'userSync': {filterSettings: {image: {bidders: '*', filter: 'exclude'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- referer: 'http://domain.com',
- gdprApplies: true
- })
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: '',
- referer: 'http://domain.com',
- gdprApplies: true
- })
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: true
- }, [], {
- consentString: null,
- referer: 'http://domain.com',
- gdprApplies: false
- })
- expect(syncs).to.have.lengthOf(0);
- });
-
- it('Verifies user syncs iframe/image include', function () {
- config.setConfig({
- 'userSync': {filterSettings: {iframe: {bidders: '*', filter: 'include'}, image: {bidders: '*', filter: 'include'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true},
- );
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('iframe');
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true,
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [], {consentString: '', gdprApplies: false});
- expect(syncs).to.have.lengthOf(1);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [], {consentString: '', gdprApplies: true});
- expect(syncs).to.have.lengthOf(0);
- });
-
- it('Verifies user syncs iframe/image exclude', function () {
- config.setConfig({
- 'userSync': {filterSettings: {iframe: {bidders: '*', filter: 'exclude'}, image: {bidders: '*', filter: 'exclude'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true},
- );
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true,
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [], {consentString: '', gdprApplies: false});
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [], {consentString: '', gdprApplies: true});
- expect(syncs).to.have.lengthOf(0);
- });
-
- it('Verifies user syncs iframe exclude / image include', function () {
- config.setConfig({
- 'userSync': {filterSettings: {iframe: {bidders: '*', filter: 'exclude'}, image: {bidders: '*', filter: 'include'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true},
- );
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('image');
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true,
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [], {consentString: '', gdprApplies: false});
- expect(syncs).to.have.lengthOf(1);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [], {consentString: '', gdprApplies: true});
- expect(syncs).to.have.lengthOf(0);
- });
-
- it('Verifies user syncs iframe include / image exclude', function () {
- config.setConfig({
- 'userSync': {filterSettings: {iframe: {bidders: '*', filter: 'include'}, image: {bidders: '*', filter: 'exclude'}}}
- })
-
- var syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true},
- );
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('iframe');
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true,
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [BID_RESPONSE], {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- });
- expect(syncs).to.have.lengthOf(0);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: true,
- pixelEnabled: true
- }, [], {consentString: '', gdprApplies: false});
- expect(syncs).to.have.lengthOf(1);
-
- syncs = spec.getUserSyncs({
- iframeEnabled: false,
- pixelEnabled: false
- }, [], {consentString: '', gdprApplies: true});
- expect(syncs).to.have.lengthOf(0);
- });
-
- it('Verifies user syncs iframe/image include with GPP', function () {
- config.setConfig({
- 'userSync': {filterSettings: {iframe: {bidders: '*', filter: 'include'}}}
- })
-
- var syncs = spec.getUserSyncs({iframeEnabled: true}, [BID_RESPONSE], {
- gppString: 'DBABL~BVVqAAEABgA.QA',
- applicableSections: [7]},
- );
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('iframe');
-
- config.setConfig({
- 'userSync': {filterSettings: {image: {bidders: '*', filter: 'include'}}}
- })
-
- var syncs = spec.getUserSyncs({pixelEnabled: true}, [BID_RESPONSE], {
- gppString: 'DBABL~BVVqAAEABgA.QA',
- applicableSections: [7, 5]},
- );
- expect(syncs).to.have.lengthOf(1);
- expect(syncs[0].type).to.equal('image');
- });
-
- it('Verifies user syncs URL image include with GPP', function () {
- const gppConsent = { gppString: 'DBACMYA~CP5P4cAP5P4cAPoABAESAlEAAAAAAAAAAAAAA2QAQA2ADZABADYAAAAA.QA2QAQA2AAAA.IA2QAQA2AAAA~BP5P4cAP5P4cAPoABABGBACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA', applicableSections: [0] };
- const result = spec.getUserSyncs({pixelEnabled: true}, undefined, undefined, undefined, gppConsent);
- expect(result).to.deep.equal([{
- type: 'image', url: `https://sync.richaudience.com/bf7c142f4339da0278e83698a02b0854/?referrer=http%3A%2F%2Fdomain.com&gpp=DBACMYA~CP5P4cAP5P4cAPoABAESAlEAAAAAAAAAAAAAA2QAQA2ADZABADYAAAAA.QA2QAQA2AAAA.IA2QAQA2AAAA~BP5P4cAP5P4cAPoABABGBACAAAAAAAAAAAAAAAAAAA.YAAAAAAAAAA&gpp_sid=0`
- }]);
- });
- })
-});