Skip to content

Commit

Permalink
update adtelligentUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
VadymShatov committed Dec 12, 2024
1 parent 35f3a0b commit 34723cd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
3 changes: 1 addition & 2 deletions libraries/adtelligentUtils/adtelligentUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import {deepAccess, isArray} from '../../src/utils.js';
import { config } from '../../src/config.js';
import {BANNER, VIDEO} from '../../src/mediaTypes.js';

const syncsCache = {};
export const supportedMediaTypes = [VIDEO, BANNER]

export function isBidRequestValid (bid) {
return !!deepAccess(bid, 'params.aid');
}

export function getUserSyncs (syncOptions, serverResponses) {
export function getUserSyncsFn (syncOptions, serverResponses, syncsCache = {}) {
const syncs = [];

function addSyncs(bid) {
Expand Down
8 changes: 5 additions & 3 deletions modules/adtargetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ import {config} from '../src/config.js';
import {find} from '../src/polyfill.js';
import {chunk} from '../libraries/chunk/chunk.js';
import {
createTag,
getUserSyncs,
createTag, getUserSyncsFn,
isBidRequestValid,
supportedMediaTypes
} from '../libraries/adtelligentUtils/adtelligentUtils.js';

const ENDPOINT = 'https://ghb.console.adtarget.com.tr/v2/auction/';
const BIDDER_CODE = 'adtarget';
const DISPLAY = 'display';
const syncsCache = {};

export const spec = {
code: BIDDER_CODE,
gvlid: 779,
supportedMediaTypes,
isBidRequestValid,
getUserSyncs,
getUserSyncs: function (syncOptions, serverResponses) {
getUserSyncsFn(syncOptions, serverResponses, syncsCache)
},

buildRequests: function (bidRequests, adapterRequest) {
const adapterSettings = config.getConfig(adapterRequest.bidderCode)
Expand Down
9 changes: 6 additions & 3 deletions modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import {Renderer} from '../src/Renderer.js';
import {find} from '../src/polyfill.js';
import {chunk} from '../libraries/chunk/chunk.js';
import {
createTag, getUserSyncs,
createTag, getUserSyncsFn,
isBidRequestValid,
supportedMediaTypes
} from '../libraries/adtelligentUtils/adtelligentUtils.js';


/**
* @typedef {import('../src/adapters/bidderFactory.js').Bid} Bid
* @typedef {import('../src/adapters/bidderFactory.js').BidderRequest} BidderRequest
Expand Down Expand Up @@ -43,6 +42,7 @@ const OUTSTREAM_SRC = 'https://player.adtelligent.com/outstream-unit/2.01/outstr
const BIDDER_CODE = 'adtelligent';
const OUTSTREAM = 'outstream';
const DISPLAY = 'display';
const syncsCache = {};

export const spec = {
code: BIDDER_CODE,
Expand All @@ -58,7 +58,9 @@ export const spec = {
],
supportedMediaTypes,
isBidRequestValid,
getUserSyncs,
getUserSyncs: function (syncOptions, serverResponses) {
getUserSyncsFn(syncOptions, serverResponses, syncsCache)
},
/**
* Make a server request from the list of BidRequests
* @param bidRequests
Expand Down Expand Up @@ -250,6 +252,7 @@ function createBid(bidResponse, bidRequest) {
/**
* Create Adtelligent renderer
* @param requestId
* @param bidderParams
* @returns {*}
*/
function newRenderer(requestId, bidderParams) {
Expand Down
8 changes: 6 additions & 2 deletions modules/viewdeosDXBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
import {findIndex} from '../src/polyfill.js';
import {
getUserSyncs,
getUserSyncsFn,
isBidRequestValid,
supportedMediaTypes
} from '../libraries/adtelligentUtils/adtelligentUtils.js';
Expand All @@ -14,14 +14,17 @@ const OUTSTREAM_SRC = 'https://player.sync.viewdeos.com/outstream-unit/2.01/outs
const BIDDER_CODE = 'viewdeosDX';
const OUTSTREAM = 'outstream';
const DISPLAY = 'display';
const syncsCache = {};

export const spec = {
code: BIDDER_CODE,
aliases: ['viewdeos'],
gvlid: 924,
supportedMediaTypes,
isBidRequestValid,
getUserSyncs,
getUserSyncs: function (syncOptions, serverResponses) {
getUserSyncsFn(syncOptions, serverResponses, syncsCache)
},
/**
* Make a server request from the list of BidRequests
* @param bidRequests
Expand Down Expand Up @@ -186,6 +189,7 @@ function createBid(bidResponse, mediaType, bidderParams) {
/**
* Create renderer
* @param requestId
* @param bidderParams
* @returns {*}
*/
function newRenderer(requestId, bidderParams) {
Expand Down

0 comments on commit 34723cd

Please sign in to comment.