Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Bid/Analytics/ID/ other modules: import utils functions as needed and not the whole module #7486

Merged
merged 89 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
33762d1
added support for pubcommon, digitrust, id5id
pm-harshad-mane Sep 12, 2019
0722354
added support for IdentityLink
pm-harshad-mane Sep 13, 2019
f2c32c0
changed the source for id5
pm-harshad-mane Sep 13, 2019
37163d1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 13, 2019
eaed987
added unit test cases
pm-harshad-mane Sep 13, 2019
602ee7e
changed source param for identityLink
pm-harshad-mane Sep 16, 2019
b6fcd36
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2019
58381f3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 26, 2019
c9fb11b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 10, 2019
8ece7fd
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
28d12a0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
05a55e1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 31, 2019
e8b10d5
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 5, 2019
870085f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
844ce4e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
704eca3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 13, 2019
2565cb9
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
1d75bd4
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
6adde1e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 6, 2019
477c98a
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 9, 2019
cef5422
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 10, 2019
c110a7d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 9, 2020
e8fb062
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 5, 2020
d77cd71
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 17, 2020
817ce3f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 24, 2020
cda825e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 26, 2020
f34a3ec
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 27, 2020
f106dc8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 4, 2020
1f6937e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
06ffe84
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
5448ceb
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
e9b90fe
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
a7a1d12
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
30b72df
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 26, 2020
76adbc9
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
50e13bc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
a1c7ca1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
96fbadc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 1, 2020
4b026e2
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 9, 2020
38740bc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 10, 2020
9daf778
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 20, 2020
eff8828
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 21, 2020
ede95de
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 21, 2020
c98f1a1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 23, 2020
312da6d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane May 18, 2020
d92972c
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 1, 2020
fd4fb2e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 26, 2020
e551136
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 30, 2020
cfdca3c
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jul 7, 2020
22505ff
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jul 28, 2020
795a54a
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 10, 2020
433c98b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 3, 2020
a0521ac
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 24, 2020
635fe74
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 25, 2020
2759212
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 12, 2020
84737d8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
df5fada
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
9ab7840
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
ed4b566
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 8, 2021
f57d220
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 20, 2021
6a6d1f4
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 9, 2021
3650c9d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 10, 2021
85c9d49
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 18, 2021
ca82340
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 23, 2021
12e8f47
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 8, 2021
5d024e7
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 15, 2021
4c87d00
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 22, 2021
93ea6ca
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane May 6, 2021
1eaefc8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 2, 2021
cd4a279
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 7, 2021
4e9ff9f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 6, 2021
f971232
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 11, 2021
24b2cd0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 6, 2021
6d3d8a1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 10, 2021
ae6dbb2
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 21, 2021
a691bc0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2021
bb3ceb1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2021
05b7793
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 24, 2021
51755a1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 24, 2021
64fdc3b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 24, 2021
bc6c9f6
import utils functions as needed and not the whole module
pm-harshad-mane Sep 24, 2021
ef500ab
import utils functions as needed and not the whole module
pm-harshad-mane Sep 24, 2021
7e3fa3f
import utils functions as needed and not the whole module
pm-harshad-mane Sep 24, 2021
0a32ede
Revert "import utils functions as needed and not the whole module"
pm-harshad-mane Sep 24, 2021
e4dc495
Revert "import utils functions as needed and not the whole module"
pm-harshad-mane Sep 24, 2021
9e42ba5
Revert "import utils functions as needed and not the whole module"
pm-harshad-mane Sep 24, 2021
7527c15
import utils functions as needed and not the whole module
pm-harshad-mane Sep 25, 2021
96d6ab4
import utils functions as needed and not the whole module
pm-harshad-mane Sep 25, 2021
01feae7
import utils functions as needed and not the whole module
pm-harshad-mane Sep 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions modules/instreamTracking.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { deepClone, getBidRequest, deepAccess } from '../src/utils.js';
import { config } from '../src/config.js';
import { auctionManager } from '../src/auctionManager.js';
import { INSTREAM } from '../src/video.js';
import * as events from '../src/events.js';
import * as utils from '../src/utils.js';
import { BID_STATUS, EVENTS, TARGETING_KEYS } from '../src/constants.json';

const {CACHE_ID, UUID} = TARGETING_KEYS;
Expand All @@ -17,7 +17,7 @@ const INSTREAM_TRACKING_DEFAULT_CONFIG = {

// Set instreamTracking default values
config.setDefaults({
'instreamTracking': utils.deepClone(INSTREAM_TRACKING_DEFAULT_CONFIG)
'instreamTracking': deepClone(INSTREAM_TRACKING_DEFAULT_CONFIG)
});

const whitelistedResources = /video|fetch|xmlhttprequest|other/;
Expand Down Expand Up @@ -50,8 +50,8 @@ export function trackInstreamDeliveredImpressions({adUnits, bidsReceived, bidder

// filter for video bids
const instreamBids = bidsReceived.filter(bid => {
const bidderRequest = utils.getBidRequest(bid.requestId, bidderRequests);
return bidderRequest && utils.deepAccess(bidderRequest, 'mediaTypes.video.context') === INSTREAM && bid.videoCacheKey;
const bidderRequest = getBidRequest(bid.requestId, bidderRequests);
return bidderRequest && deepAccess(bidderRequest, 'mediaTypes.video.context') === INSTREAM && bid.videoCacheKey;
});
if (!instreamBids.length) {
return false;
Expand All @@ -60,7 +60,7 @@ export function trackInstreamDeliveredImpressions({adUnits, bidsReceived, bidder
// find unique instream ad units
const instreamAdUnitMap = {};
adUnits.forEach(adUnit => {
if (!instreamAdUnitMap[adUnit.code] && utils.deepAccess(adUnit, 'mediaTypes.video.context') === INSTREAM) {
if (!instreamAdUnitMap[adUnit.code] && deepAccess(adUnit, 'mediaTypes.video.context') === INSTREAM) {
instreamAdUnitMap[adUnit.code] = true;
}
});
Expand Down
8 changes: 4 additions & 4 deletions modules/integr8BidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { deepAccess, isFn, isPlainObject } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import * as utils from '../src/utils.js';

const BIDDER_CODE = 'integr8';
const ENDPOINT_URL = 'https://integr8.central.gjirafa.tech/bid';
Expand Down Expand Up @@ -62,7 +62,7 @@ export const spec = {
placementId: bidRequest.params.placementId,
bidid: bidRequest.bidId,
count: bidRequest.params.count,
skipTime: utils.deepAccess(bidRequest, 'mediaTypes.video.skipafter', bidRequest.params.skipTime),
skipTime: deepAccess(bidRequest, 'mediaTypes.video.skipafter', bidRequest.params.skipTime),
floor: getBidFloor(bidRequest)
};
});
Expand Down Expand Up @@ -130,7 +130,7 @@ function generateSizeParam(sizes) {
}

export function getBidFloor(bid) {
if (!utils.isFn(bid.getFloor)) {
if (!isFn(bid.getFloor)) {
return null;
}

Expand All @@ -140,7 +140,7 @@ export function getBidFloor(bid) {
size: '*'
});

if (utils.isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'EUR') {
if (isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'EUR') {
return floor.floor;
}

Expand Down
14 changes: 7 additions & 7 deletions modules/intentIqIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @requires module:modules/userId
*/

import * as utils from '../src/utils.js'
import { logError, logInfo } from '../src/utils.js';
import {ajax} from '../src/ajax.js';
import {submodule} from '../src/hook.js'
import {getStorageManager} from '../src/storageManager.js';
Expand Down Expand Up @@ -47,7 +47,7 @@ export function readData(key) {
return storage.getCookie(key);
}
} catch (error) {
utils.logError(error);
logError(error);
}
}

Expand All @@ -59,7 +59,7 @@ export function readData(key) {
*/
function storeData(key, value) {
try {
utils.logInfo(MODULE_NAME + ': storing data: key=' + key + ' value=' + value);
logInfo(MODULE_NAME + ': storing data: key=' + key + ' value=' + value);

if (value) {
if (storage.hasLocalStorage()) {
Expand All @@ -71,7 +71,7 @@ function storeData(key, value) {
}
}
} catch (error) {
utils.logError(error);
logError(error);
}
}

Expand All @@ -84,7 +84,7 @@ function tryParse(data) {
try {
return JSON.parse(data);
} catch (err) {
utils.logError(err);
logError(err);
return null;
}
}
Expand Down Expand Up @@ -114,7 +114,7 @@ export const intentIqIdSubmodule = {
getId(config) {
const configParams = (config && config.params) || {};
if (!configParams || typeof configParams.partner !== 'number') {
utils.logError('User ID - intentIqId submodule requires a valid partner to be defined');
logError('User ID - intentIqId submodule requires a valid partner to be defined');
return;
}

Expand Down Expand Up @@ -155,7 +155,7 @@ export const intentIqIdSubmodule = {
}
},
error: error => {
utils.logError(MODULE_NAME + ': ID fetch encountered an error', error);
logError(MODULE_NAME + ': ID fetch encountered an error', error);
callback();
}
};
Expand Down
10 changes: 5 additions & 5 deletions modules/interactiveOffersBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { logWarn, isNumber } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
import * as utils from '../src/utils.js';

const BIDDER_CODE = 'interactiveOffers';
const ENDPOINT = 'https://prebid.ioadx.com/bidRequest/?partnerId=';
Expand Down Expand Up @@ -36,15 +36,15 @@ export const spec = {
let ret = true;
if (bid && bid.params) {
if (!bid.params.partnerId) {
utils.logWarn('partnerId must be a valid ID');
logWarn('partnerId must be a valid ID');
ret = false;
}
if (bid.params.tmax && !utils.isNumber(bid.params.tmax)) {
utils.logWarn('tmax must be a valid numeric ID');
if (bid.params.tmax && !isNumber(bid.params.tmax)) {
logWarn('tmax must be a valid numeric ID');
ret = false;
}
} else {
utils.logWarn('invalid request');
logWarn('invalid request');
ret = false;
}
return ret;
Expand Down
22 changes: 11 additions & 11 deletions modules/invibesBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from '../src/utils.js';
import { logInfo } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {getStorageManager} from '../src/storageManager.js';

Expand Down Expand Up @@ -155,12 +155,12 @@ function buildRequest(bidRequests, bidderRequest) {

function handleResponse(responseObj, bidRequests) {
if (bidRequests == null || bidRequests.length === 0) {
utils.logInfo('Invibes Adapter - No bids have been requested');
logInfo('Invibes Adapter - No bids have been requested');
return [];
}

if (!responseObj) {
utils.logInfo('Invibes Adapter - Bid response is empty');
logInfo('Invibes Adapter - Bid response is empty');
return [];
}

Expand All @@ -171,7 +171,7 @@ function handleResponse(responseObj, bidRequests) {
if (responseObj.MultipositionEnabled === true) {
invibes.bidResponse.AdPlacements = invibes.bidResponse.AdPlacements.concat(responseObj.AdPlacements);
} else {
utils.logInfo('Invibes Adapter - Bid response already received. Invibes only responds to one bid request per user visit');
logInfo('Invibes Adapter - Bid response already received. Invibes only responds to one bid request per user visit');
return [];
}
} else {
Expand All @@ -183,7 +183,7 @@ function handleResponse(responseObj, bidRequests) {
let bidRequest = bidRequests[i];

if (invibes.placementBids.indexOf(bidRequest.params.placementId) > -1) {
utils.logInfo('Invibes Adapter - Placement was previously bid on ' + bidRequest.params.placementId);
logInfo('Invibes Adapter - Placement was previously bid on ' + bidRequest.params.placementId);
continue;
}

Expand Down Expand Up @@ -215,18 +215,18 @@ function handleResponse(responseObj, bidRequests) {

function createBid(bidRequest, requestPlacement, multipositionEnabled) {
if (requestPlacement === null || requestPlacement.BidModel === null) {
utils.logInfo('Invibes Adapter - Placement not configured for bidding ' + bidRequest.params.placementId);
logInfo('Invibes Adapter - Placement not configured for bidding ' + bidRequest.params.placementId);
return null;
}

let bidModel = requestPlacement.BidModel;
let ads = requestPlacement.Ads;
if (!Array.isArray(ads) || ads.length < 1) {
if (requestPlacement.AdReason != null) {
utils.logInfo('Invibes Adapter - No ads ' + requestPlacement.AdReason);
logInfo('Invibes Adapter - No ads ' + requestPlacement.AdReason);
}

utils.logInfo('Invibes Adapter - No ads available');
logInfo('Invibes Adapter - No ads available');
return null;
}

Expand All @@ -241,7 +241,7 @@ function createBid(bidRequest, requestPlacement, multipositionEnabled) {
});

if (blacklistsPushedCids) {
utils.logInfo('Invibes Adapter - Ad blacklists pushed ids');
logInfo('Invibes Adapter - Ad blacklists pushed ids');
return null;
}
}
Expand All @@ -250,15 +250,15 @@ function createBid(bidRequest, requestPlacement, multipositionEnabled) {
return invibes.pushedCids[pushedCid].indexOf(ad.Cid) > -1;
});
if (isBlacklisted) {
utils.logInfo('Invibes Adapter - Ad is blacklisted');
logInfo('Invibes Adapter - Ad is blacklisted');
return null;
}
}
}

invibes.pushedCids[ad.Cid] = ad.Blcids || [];
const now = Date.now();
utils.logInfo('Bid auction started at ' + bidModel.AuctionStartTime + ' . Invibes registered the bid at ' + now + ' ; bid request took a total of ' + (now - bidModel.AuctionStartTime) + ' ms.');
logInfo('Bid auction started at ' + bidModel.AuctionStartTime + ' . Invibes registered the bid at ' + now + ' ; bid request took a total of ' + (now - bidModel.AuctionStartTime) + ' ms.');

return {
requestId: bidRequest.bidId,
Expand Down
10 changes: 5 additions & 5 deletions modules/invisiblyAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { ajaxBuilder } from '../src/ajax.js';
import adapter from '../src/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';

import { generateUUID, logInfo } from '../src/utils.js';

const DEFAULT_EVENT_URL = 'https://api.pymx5.com/v1/' + 'sites/events';
const analyticsType = 'endpoint';
const analyticsName = 'Invisibly Analytics Adapter:';

const utils = require('../src/utils.js');
const CONSTANTS = require('../src/constants.json');
const ajax = ajaxBuilder(0);

Expand All @@ -33,7 +33,7 @@ const {
} = CONSTANTS;

const _VERSION = 1;
const _pageViewId = utils.generateUUID();
const _pageViewId = generateUUID();
let initOptions = null;
let _startAuction = 0;
let _bidRequestTimeout = 0;
Expand Down Expand Up @@ -122,7 +122,7 @@ function flush() {
};
ajax(
initOptions.url,
() => utils.logInfo(`${analyticsName} sent events batch`),
() => logInfo(`${analyticsName} sent events batch`),
JSON.stringify(payload),
{
contentType: 'application/json',
Expand Down Expand Up @@ -206,7 +206,7 @@ function handleEvent(eventType, eventArgs) {

function sendEvent(event) {
_eventQueue.push(event);
utils.logInfo(`${analyticsName}Event ${event.eventType}:`, event);
logInfo(`${analyticsName}Event ${event.eventType}:`, event);

if (event.eventType === AUCTION_END) {
flush();
Expand Down
Loading