prebid.js 6.28.0 → 6.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adoceanBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/audiencerunBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bluebillywigBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectIdSystem.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consentManagement.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/currency.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/gdprEnforcement.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/impactifyBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/jixieBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -0
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediakeysBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/merkleIdSystem.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +120 -119
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/oneVideoBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +3 -3
- package/dist/pubCommonId.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticAnalyticsAdapter.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharedIdSystem.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sortableBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/trustxBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/modules/adoceanBidAdapter.js +29 -1
- package/modules/consentManagement.js +20 -10
- package/modules/currency.js +2 -2
- package/modules/gdprEnforcement.js +15 -9
- package/modules/insticatorBidAdapter.js +109 -42
- package/modules/ixBidAdapter.js +3 -2
- package/modules/ixBidAdapter.md +1 -1
- package/modules/lassoBidAdapter.js +133 -0
- package/modules/lassoBidAdapter.md +29 -0
- package/modules/merkleIdSystem.js +43 -31
- package/modules/pubCommonId.js +2 -1
- package/modules/pubmaticAnalyticsAdapter.js +49 -33
- package/modules/sharedIdSystem.js +5 -11
- package/modules/synacormediaBidAdapter.js +11 -2
- package/modules/taboolaBidAdapter.js +1 -1
- package/modules/userId/eids.js +25 -5
- package/modules/userId/index.js +39 -21
- package/package.json +1 -1
- package/src/auction.js +6 -5
- package/src/consentHandler.js +11 -11
- package/src/hook.js +2 -2
- package/src/storageManager.js +5 -4
- package/src/utils/promise.js +96 -21
- package/src/utils.js +3 -2
- package/test/helpers/consentData.js +2 -1
- package/test/spec/auctionmanager_spec.js +1 -6
- package/test/spec/modules/adoceanBidAdapter_spec.js +25 -1
- package/test/spec/modules/consentManagement_spec.js +75 -16
- package/test/spec/modules/eids_spec.js +48 -3
- package/test/spec/modules/gdprEnforcement_spec.js +100 -53
- package/test/spec/modules/idxIdSystem_spec.js +1 -1
- package/test/spec/modules/insticatorBidAdapter_spec.js +46 -1
- package/test/spec/modules/ixBidAdapter_spec.js +1 -1
- package/test/spec/modules/lassoBidAdapter_spec.js +177 -0
- package/test/spec/modules/merkleIdSystem_spec.js +58 -37
- package/test/spec/modules/parrableIdSystem_spec.js +2 -1
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +117 -0
- package/test/spec/modules/synacormediaBidAdapter_spec.js +74 -0
- package/test/spec/modules/userId_spec.js +42 -3
- package/test/spec/modules/vidazooBidAdapter_spec.js +9 -4
- package/test/spec/unit/pbjs_api_spec.js +2 -6
- package/test/spec/unit/utils/promise_spec.js +283 -38
- package/test/helpers/syncPromise.js +0 -71
|
@@ -83,6 +83,8 @@ function setMediaTypes(types, bid) {
|
|
|
83
83
|
function copyRequiredBidDetails(bid) {
|
|
84
84
|
return pick(bid, [
|
|
85
85
|
'bidder',
|
|
86
|
+
'bidderCode',
|
|
87
|
+
'adapterCode',
|
|
86
88
|
'bidId',
|
|
87
89
|
'status', () => NO_BID, // default a bid to NO_BID until response is recieved or bid is timed out
|
|
88
90
|
'finalSource as source',
|
|
@@ -90,7 +92,7 @@ function copyRequiredBidDetails(bid) {
|
|
|
90
92
|
'adUnit', () => pick(bid, [
|
|
91
93
|
'adUnitCode',
|
|
92
94
|
'transactionId',
|
|
93
|
-
'sizes as dimensions', sizes => sizes.map(sizeToDimensions),
|
|
95
|
+
'sizes as dimensions', sizes => sizes && sizes.map(sizeToDimensions),
|
|
94
96
|
'mediaTypes', (types) => setMediaTypes(types, bid)
|
|
95
97
|
])
|
|
96
98
|
]);
|
|
@@ -185,11 +187,11 @@ function getDevicePlatform() {
|
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
function getValueForKgpv(bid, adUnitId) {
|
|
188
|
-
if (bid.params.regexPattern) {
|
|
190
|
+
if (bid.params && bid.params.regexPattern) {
|
|
189
191
|
return bid.params.regexPattern;
|
|
190
192
|
} else if (bid.bidResponse && bid.bidResponse.regexPattern) {
|
|
191
193
|
return bid.bidResponse.regexPattern;
|
|
192
|
-
} else if (bid.params.kgpv) {
|
|
194
|
+
} else if (bid.params && bid.params.kgpv) {
|
|
193
195
|
return bid.params.kgpv;
|
|
194
196
|
} else {
|
|
195
197
|
return adUnitId;
|
|
@@ -218,30 +220,31 @@ function getAdDomain(bidResponse) {
|
|
|
218
220
|
function gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestBid) {
|
|
219
221
|
highestBid = (highestBid && highestBid.length > 0) ? highestBid[0] : null;
|
|
220
222
|
return Object.keys(adUnit.bids).reduce(function(partnerBids, bidId) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
223
|
+
adUnit.bids[bidId].forEach(function(bid) {
|
|
224
|
+
partnerBids.push({
|
|
225
|
+
'pn': getAdapterNameForAlias(bid.adapterCode || bid.bidder),
|
|
226
|
+
'bc': bid.bidderCode || bid.bidder,
|
|
227
|
+
'bidid': bid.bidId || bidId,
|
|
228
|
+
'db': bid.bidResponse ? 0 : 1,
|
|
229
|
+
'kgpv': getValueForKgpv(bid, adUnitId),
|
|
230
|
+
'kgpsv': bid.params && bid.params.kgpv ? bid.params.kgpv : adUnitId,
|
|
231
|
+
'psz': bid.bidResponse ? (bid.bidResponse.dimensions.width + 'x' + bid.bidResponse.dimensions.height) : '0x0',
|
|
232
|
+
'eg': bid.bidResponse ? bid.bidResponse.bidGrossCpmUSD : 0,
|
|
233
|
+
'en': bid.bidResponse ? bid.bidResponse.bidPriceUSD : 0,
|
|
234
|
+
'di': bid.bidResponse ? (bid.bidResponse.dealId || EMPTY_STRING) : EMPTY_STRING,
|
|
235
|
+
'dc': bid.bidResponse ? (bid.bidResponse.dealChannel || EMPTY_STRING) : EMPTY_STRING,
|
|
236
|
+
'l1': bid.bidResponse ? bid.clientLatencyTimeMs : 0,
|
|
237
|
+
'l2': 0,
|
|
238
|
+
'adv': bid.bidResponse ? getAdDomain(bid.bidResponse) || undefined : undefined,
|
|
239
|
+
'ss': (s2sBidders.indexOf(bid.bidder) > -1) ? 1 : 0,
|
|
240
|
+
't': (bid.status == ERROR && bid.error.code == TIMEOUT_ERROR) ? 1 : 0,
|
|
241
|
+
'wb': (highestBid && highestBid.adId === bid.adId ? 1 : 0),
|
|
242
|
+
'mi': bid.bidResponse ? (bid.bidResponse.mi || undefined) : undefined,
|
|
243
|
+
'af': bid.bidResponse ? (bid.bidResponse.mediaType || undefined) : undefined,
|
|
244
|
+
'ocpm': bid.bidResponse ? (bid.bidResponse.originalCpm || 0) : 0,
|
|
245
|
+
'ocry': bid.bidResponse ? (bid.bidResponse.originalCurrency || CURRENCY_USD) : CURRENCY_USD,
|
|
246
|
+
'piid': bid.bidResponse ? (bid.bidResponse.partnerImpId || EMPTY_STRING) : EMPTY_STRING
|
|
247
|
+
});
|
|
245
248
|
});
|
|
246
249
|
return partnerBids;
|
|
247
250
|
}, [])
|
|
@@ -307,8 +310,14 @@ function executeBidsLoggerCall(e, highestCpmBids) {
|
|
|
307
310
|
|
|
308
311
|
function executeBidWonLoggerCall(auctionId, adUnitId) {
|
|
309
312
|
const winningBidId = cache.auctions[auctionId].adUnitCodes[adUnitId].bidWon;
|
|
310
|
-
const
|
|
311
|
-
|
|
313
|
+
const winningBids = cache.auctions[auctionId].adUnitCodes[adUnitId].bids[winningBidId];
|
|
314
|
+
let winningBid = winningBids[0];
|
|
315
|
+
|
|
316
|
+
if (winningBids.length > 1) {
|
|
317
|
+
winningBid = winningBids.filter(bid => bid.adId === cache.auctions[auctionId].adUnitCodes[adUnitId].bidWonAdId)[0];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const adapterName = getAdapterNameForAlias(winningBid.adapterCode || winningBid.bidder);
|
|
312
321
|
let pixelURL = END_POINT_WIN_BID_LOGGER;
|
|
313
322
|
pixelURL += 'pubid=' + publisherId;
|
|
314
323
|
pixelURL += '&purl=' + enc(config.getConfig('pageUrl') || cache.auctions[auctionId].referer || '');
|
|
@@ -319,7 +328,7 @@ function executeBidWonLoggerCall(auctionId, adUnitId) {
|
|
|
319
328
|
pixelURL += '&pdvid=' + enc(profileVersionId);
|
|
320
329
|
pixelURL += '&slot=' + enc(adUnitId);
|
|
321
330
|
pixelURL += '&pn=' + enc(adapterName);
|
|
322
|
-
pixelURL += '&bc=' + enc(winningBid.bidder);
|
|
331
|
+
pixelURL += '&bc=' + enc(winningBid.bidderCode || winningBid.bidder);
|
|
323
332
|
pixelURL += '&en=' + enc(winningBid.bidResponse.bidPriceUSD);
|
|
324
333
|
pixelURL += '&eg=' + enc(winningBid.bidResponse.bidGrossCpmUSD);
|
|
325
334
|
pixelURL += '&kgpv=' + enc(getValueForKgpv(winningBid, adUnitId));
|
|
@@ -362,16 +371,22 @@ function bidRequestedHandler(args) {
|
|
|
362
371
|
dimensions: bid.sizes
|
|
363
372
|
};
|
|
364
373
|
}
|
|
365
|
-
cache.auctions[args.auctionId].adUnitCodes[bid.adUnitCode].bids[bid.bidId] = copyRequiredBidDetails(bid);
|
|
374
|
+
cache.auctions[args.auctionId].adUnitCodes[bid.adUnitCode].bids[bid.bidId] = [copyRequiredBidDetails(bid)];
|
|
366
375
|
})
|
|
367
376
|
}
|
|
368
377
|
|
|
369
378
|
function bidResponseHandler(args) {
|
|
370
|
-
let bid = cache.auctions[args.auctionId].adUnitCodes[args.adUnitCode].bids[args.requestId];
|
|
379
|
+
let bid = cache.auctions[args.auctionId].adUnitCodes[args.adUnitCode].bids[args.requestId][0];
|
|
371
380
|
if (!bid) {
|
|
372
381
|
logError(LOG_PRE_FIX + 'Could not find associated bid request for bid response with requestId: ', args.requestId);
|
|
373
382
|
return;
|
|
374
383
|
}
|
|
384
|
+
|
|
385
|
+
if (bid.bidder && args.bidderCode && bid.bidder !== args.bidderCode) {
|
|
386
|
+
bid = copyRequiredBidDetails(args);
|
|
387
|
+
cache.auctions[args.auctionId].adUnitCodes[args.adUnitCode].bids[args.requestId].push(bid)
|
|
388
|
+
}
|
|
389
|
+
bid.adId = args.adId;
|
|
375
390
|
bid.source = formatSource(bid.source || args.source);
|
|
376
391
|
setBidStatus(bid, args);
|
|
377
392
|
bid.clientLatencyTimeMs = Date.now() - cache.auctions[args.auctionId].timestamp;
|
|
@@ -397,6 +412,7 @@ function bidderDoneHandler(args) {
|
|
|
397
412
|
function bidWonHandler(args) {
|
|
398
413
|
let auctionCache = cache.auctions[args.auctionId];
|
|
399
414
|
auctionCache.adUnitCodes[args.adUnitCode].bidWon = args.requestId;
|
|
415
|
+
auctionCache.adUnitCodes[args.adUnitCode].bidWonAdId = args.adId;
|
|
400
416
|
executeBidWonLoggerCall(args.auctionId, args.adUnitCode);
|
|
401
417
|
}
|
|
402
418
|
|
|
@@ -413,7 +429,7 @@ function bidTimeoutHandler(args) {
|
|
|
413
429
|
// db = 0 and t = 1 means bidder did respond with a bid but post timeout
|
|
414
430
|
args.forEach(badBid => {
|
|
415
431
|
let auctionCache = cache.auctions[badBid.auctionId];
|
|
416
|
-
let bid = auctionCache.adUnitCodes[badBid.adUnitCode].bids[ badBid.bidId || badBid.requestId ];
|
|
432
|
+
let bid = auctionCache.adUnitCodes[badBid.adUnitCode].bids[ badBid.bidId || badBid.requestId ][0];
|
|
417
433
|
if (bid) {
|
|
418
434
|
bid.status = ERROR;
|
|
419
435
|
bid.error = {
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* @requires module:modules/userId
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {buildUrl, generateUUID, hasDeviceAccess, logInfo, parseUrl, triggerPixel} from '../src/utils.js';
|
|
9
9
|
import {submodule} from '../src/hook.js';
|
|
10
|
-
import {
|
|
10
|
+
import {coppaDataHandler} from '../src/adapterManager.js';
|
|
11
11
|
import {getStorageManager} from '../src/storageManager.js';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
export const storage = getStorageManager({
|
|
13
|
+
const MODULE_TYPE = 'fpid-module';
|
|
14
|
+
export const storage = getStorageManager({moduleName: 'pubCommonId', moduleType: MODULE_TYPE});
|
|
15
15
|
const COOKIE = 'cookie';
|
|
16
16
|
const LOCAL_STORAGE = 'html5';
|
|
17
17
|
const OPTOUT_NAME = '_pubcid_optout';
|
|
@@ -74,11 +74,6 @@ export const sharedIdSystemSubmodule = {
|
|
|
74
74
|
*/
|
|
75
75
|
name: 'sharedId',
|
|
76
76
|
aliasName: 'pubCommonId',
|
|
77
|
-
/**
|
|
78
|
-
* Vendor id of prebid
|
|
79
|
-
* @type {Number}
|
|
80
|
-
*/
|
|
81
|
-
gvlid: GVLID,
|
|
82
77
|
|
|
83
78
|
/**
|
|
84
79
|
* decode the stored id value for passing to bid requests
|
|
@@ -93,8 +88,7 @@ export const sharedIdSystemSubmodule = {
|
|
|
93
88
|
return undefined;
|
|
94
89
|
}
|
|
95
90
|
logInfo(' Decoded value PubCommonId ' + value);
|
|
96
|
-
|
|
97
|
-
return idObj;
|
|
91
|
+
return {'pubcid': value};
|
|
98
92
|
},
|
|
99
93
|
/**
|
|
100
94
|
* performs action to obtain id
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import {deepSetValue, getAdUnitSizes, isFn, isPlainObject, logWarn} from '../src/utils.js';
|
|
3
|
+
import {deepAccess, deepSetValue, getAdUnitSizes, isFn, isPlainObject, logWarn} from '../src/utils.js';
|
|
4
4
|
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
5
5
|
import {BANNER, VIDEO} from '../src/mediaTypes.js';
|
|
6
6
|
import {includes} from '../src/polyfill.js';
|
|
@@ -79,7 +79,16 @@ export const spec = {
|
|
|
79
79
|
imps = this.buildVideoImpressions(adSizes, bid, tagIdOrPlacementId, pos, videoOrBannerKey);
|
|
80
80
|
}
|
|
81
81
|
if (imps.length > 0) {
|
|
82
|
-
imps.forEach(i =>
|
|
82
|
+
imps.forEach(i => {
|
|
83
|
+
// Deeply add ext section to all imp[] for GPID, prebid slot id, and anything else down the line
|
|
84
|
+
const extSection = deepAccess(bid, 'ortb2Imp.ext');
|
|
85
|
+
if (extSection) {
|
|
86
|
+
deepSetValue(i, 'ext', extSection);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Add imp[] to request object
|
|
90
|
+
openRtbBidRequest.imp.push(i);
|
|
91
|
+
});
|
|
83
92
|
}
|
|
84
93
|
});
|
|
85
94
|
|
|
@@ -9,7 +9,7 @@ import {getStorageManager} from '../src/storageManager.js';
|
|
|
9
9
|
const BIDDER_CODE = 'taboola';
|
|
10
10
|
const GVLID = 42;
|
|
11
11
|
const CURRENCY = 'USD';
|
|
12
|
-
export const END_POINT_URL = '
|
|
12
|
+
export const END_POINT_URL = 'https://hb.bidder.taboola.com/TaboolaHBOpenRTBRequestHandlerServlet';
|
|
13
13
|
const USER_ID = 'user-id';
|
|
14
14
|
const STORAGE_KEY = `taboola global:${USER_ID}`;
|
|
15
15
|
const COOKIE_KEY = 'trc_cookie_storage';
|
package/modules/userId/eids.js
CHANGED
|
@@ -151,15 +151,25 @@ export const USER_IDS_CONFIG = {
|
|
|
151
151
|
|
|
152
152
|
// merkleId
|
|
153
153
|
'merkleId': {
|
|
154
|
-
source: 'merkleinc.com',
|
|
155
154
|
atype: 3,
|
|
155
|
+
getSource: function(data) {
|
|
156
|
+
if (data?.ext?.ssp) {
|
|
157
|
+
return `${data.ext.ssp}.merkleinc.com`
|
|
158
|
+
}
|
|
159
|
+
return 'merkleinc.com'
|
|
160
|
+
},
|
|
156
161
|
getValue: function(data) {
|
|
157
162
|
return data.id;
|
|
158
163
|
},
|
|
159
164
|
getUidExt: function(data) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
if (data.keyID) {
|
|
166
|
+
return {
|
|
167
|
+
keyID: data.keyID
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (data.ext) {
|
|
171
|
+
return data.ext;
|
|
172
|
+
}
|
|
163
173
|
}
|
|
164
174
|
},
|
|
165
175
|
|
|
@@ -327,7 +337,8 @@ function createEidObject(userIdData, subModuleKey) {
|
|
|
327
337
|
const conf = USER_IDS_CONFIG[subModuleKey];
|
|
328
338
|
if (conf && userIdData) {
|
|
329
339
|
let eid = {};
|
|
330
|
-
eid.source = conf['source'];
|
|
340
|
+
eid.source = isFn(conf['getSource']) ? conf['getSource'](userIdData) : conf['source'];
|
|
341
|
+
|
|
331
342
|
const value = isFn(conf['getValue']) ? conf['getValue'](userIdData) : userIdData;
|
|
332
343
|
if (isStr(value)) {
|
|
333
344
|
const uid = { id: value, atype: conf['atype'] };
|
|
@@ -357,10 +368,19 @@ function createEidObject(userIdData, subModuleKey) {
|
|
|
357
368
|
// if any adapter does not want any particular userId to be passed then adapter can use Array.filter(e => e.source != 'tdid')
|
|
358
369
|
export function createEidsArray(bidRequestUserId) {
|
|
359
370
|
let eids = [];
|
|
371
|
+
|
|
360
372
|
for (const subModuleKey in bidRequestUserId) {
|
|
361
373
|
if (bidRequestUserId.hasOwnProperty(subModuleKey)) {
|
|
362
374
|
if (subModuleKey === 'pubProvidedId') {
|
|
363
375
|
eids = eids.concat(bidRequestUserId['pubProvidedId']);
|
|
376
|
+
} else if (Array.isArray(bidRequestUserId[subModuleKey])) {
|
|
377
|
+
bidRequestUserId[subModuleKey].forEach((config, index, arr) => {
|
|
378
|
+
const eid = createEidObject(config, subModuleKey);
|
|
379
|
+
|
|
380
|
+
if (eid) {
|
|
381
|
+
eids.push(eid);
|
|
382
|
+
}
|
|
383
|
+
})
|
|
364
384
|
} else {
|
|
365
385
|
const eid = createEidObject(bidRequestUserId[subModuleKey], subModuleKey);
|
|
366
386
|
if (eid) {
|
package/modules/userId/index.js
CHANGED
|
@@ -152,7 +152,7 @@ import {
|
|
|
152
152
|
isEmpty
|
|
153
153
|
} from '../../src/utils.js';
|
|
154
154
|
import {getPPID as coreGetPPID} from '../../src/adserver.js';
|
|
155
|
-
import {
|
|
155
|
+
import {defer, GreedyPromise} from '../../src/utils/promise.js';
|
|
156
156
|
|
|
157
157
|
const MODULE_NAME = 'User ID';
|
|
158
158
|
const COOKIE = 'cookie';
|
|
@@ -523,15 +523,11 @@ function addIdDataToAdUnitBids(adUnits, submodules) {
|
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
-
function delayFor(ms) {
|
|
527
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
528
|
-
}
|
|
529
|
-
|
|
530
526
|
const INIT_CANCELED = {};
|
|
531
527
|
|
|
532
|
-
function idSystemInitializer({delay =
|
|
533
|
-
const startInit =
|
|
534
|
-
const startCallbacks =
|
|
528
|
+
function idSystemInitializer({delay = GreedyPromise.timeout} = {}) {
|
|
529
|
+
const startInit = defer();
|
|
530
|
+
const startCallbacks = defer();
|
|
535
531
|
let cancel;
|
|
536
532
|
let initialized = false;
|
|
537
533
|
|
|
@@ -539,8 +535,8 @@ function idSystemInitializer({delay = delayFor} = {}) {
|
|
|
539
535
|
if (cancel != null) {
|
|
540
536
|
cancel.reject(INIT_CANCELED);
|
|
541
537
|
}
|
|
542
|
-
cancel =
|
|
543
|
-
return
|
|
538
|
+
cancel = defer();
|
|
539
|
+
return GreedyPromise.race([promise, cancel.promise]);
|
|
544
540
|
}
|
|
545
541
|
|
|
546
542
|
// grab a reference to global vars so that the promise chains remain isolated;
|
|
@@ -559,7 +555,7 @@ function idSystemInitializer({delay = delayFor} = {}) {
|
|
|
559
555
|
}
|
|
560
556
|
|
|
561
557
|
let done = cancelAndTry(
|
|
562
|
-
|
|
558
|
+
GreedyPromise.all([hooksReady, startInit.promise])
|
|
563
559
|
.then(() => gdprDataHandler.promise)
|
|
564
560
|
.then(checkRefs((consentData) => {
|
|
565
561
|
initSubmodules(initModules, allModules, consentData);
|
|
@@ -568,7 +564,7 @@ function idSystemInitializer({delay = delayFor} = {}) {
|
|
|
568
564
|
.then(checkRefs(() => {
|
|
569
565
|
const modWithCb = initModules.filter(item => isFn(item.callback));
|
|
570
566
|
if (modWithCb.length) {
|
|
571
|
-
return new
|
|
567
|
+
return new GreedyPromise((resolve) => processSubmoduleCallbacks(modWithCb, resolve));
|
|
572
568
|
}
|
|
573
569
|
}))
|
|
574
570
|
);
|
|
@@ -592,7 +588,7 @@ function idSystemInitializer({delay = delayFor} = {}) {
|
|
|
592
588
|
});
|
|
593
589
|
}
|
|
594
590
|
}
|
|
595
|
-
if (refresh) {
|
|
591
|
+
if (refresh && initialized) {
|
|
596
592
|
done = cancelAndTry(
|
|
597
593
|
done
|
|
598
594
|
.catch(() => null)
|
|
@@ -607,7 +603,7 @@ function idSystemInitializer({delay = delayFor} = {}) {
|
|
|
607
603
|
return sm.callback != null;
|
|
608
604
|
});
|
|
609
605
|
if (cbModules.length) {
|
|
610
|
-
return new
|
|
606
|
+
return new GreedyPromise((resolve) => processSubmoduleCallbacks(cbModules, resolve));
|
|
611
607
|
}
|
|
612
608
|
}))
|
|
613
609
|
);
|
|
@@ -640,8 +636,8 @@ function getPPID() {
|
|
|
640
636
|
* @param {Object} reqBidsConfigObj required; This is the same param that's used in pbjs.requestBids.
|
|
641
637
|
* @param {function} fn required; The next function in the chain, used by hook.js
|
|
642
638
|
*/
|
|
643
|
-
export function requestBidsHook(fn, reqBidsConfigObj, {delay =
|
|
644
|
-
|
|
639
|
+
export function requestBidsHook(fn, reqBidsConfigObj, {delay = GreedyPromise.timeout} = {}) {
|
|
640
|
+
GreedyPromise.race([
|
|
645
641
|
getUserIdsAsync(),
|
|
646
642
|
delay(auctionDelay)
|
|
647
643
|
]).then(() => {
|
|
@@ -786,7 +782,16 @@ function refreshUserIds({submoduleNames} = {}, callback) {
|
|
|
786
782
|
*/
|
|
787
783
|
|
|
788
784
|
function getUserIdsAsync() {
|
|
789
|
-
return initIdSystem().then(
|
|
785
|
+
return initIdSystem().then(
|
|
786
|
+
() => getUserIds(),
|
|
787
|
+
(e) =>
|
|
788
|
+
e === INIT_CANCELED
|
|
789
|
+
// there's a pending refresh - because GreedyPromise runs this synchronously, we are now in the middle
|
|
790
|
+
// of canceling the previous init, before the refresh logic has had a chance to run.
|
|
791
|
+
// Use a "normal" Promise to clear the stack and let it complete (or this will just recurse infinitely)
|
|
792
|
+
? Promise.resolve().then(getUserIdsAsync)
|
|
793
|
+
: GreedyPromise.reject(e)
|
|
794
|
+
);
|
|
790
795
|
}
|
|
791
796
|
|
|
792
797
|
/**
|
|
@@ -933,6 +938,8 @@ function updateSubmodules() {
|
|
|
933
938
|
return;
|
|
934
939
|
}
|
|
935
940
|
// do this to avoid reprocessing submodules
|
|
941
|
+
// TODO: the logic does not match the comment - addedSubmodules is always a copy of submoduleRegistry
|
|
942
|
+
// (if it did it would not be correct - it's not enough to find new modules, as others may have been removed or changed)
|
|
936
943
|
const addedSubmodules = submoduleRegistry.filter(i => !find(submodules, j => j.name === i.name));
|
|
937
944
|
|
|
938
945
|
submodules.splice(0, submodules.length);
|
|
@@ -968,6 +975,17 @@ export function attachIdSystem(submodule) {
|
|
|
968
975
|
if (!find(submoduleRegistry, i => i.name === submodule.name)) {
|
|
969
976
|
submoduleRegistry.push(submodule);
|
|
970
977
|
updateSubmodules();
|
|
978
|
+
// TODO: a test case wants this to work even if called after init (the setConfig({userId}))
|
|
979
|
+
// so we trigger a refresh. But is that even possible outside of tests?
|
|
980
|
+
initIdSystem({refresh: true, submoduleNames: [submodule.name]});
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
function normalizePromise(fn) {
|
|
985
|
+
// for public methods that return promises, make sure we return a "normal" one - to avoid
|
|
986
|
+
// exposing confusing stack traces
|
|
987
|
+
return function() {
|
|
988
|
+
return Promise.resolve(fn.apply(this, arguments));
|
|
971
989
|
}
|
|
972
990
|
}
|
|
973
991
|
|
|
@@ -976,7 +994,7 @@ export function attachIdSystem(submodule) {
|
|
|
976
994
|
* so a callback is added to fire after the consentManagement module.
|
|
977
995
|
* @param {{getConfig:function}} config
|
|
978
996
|
*/
|
|
979
|
-
export function init(config, {delay =
|
|
997
|
+
export function init(config, {delay = GreedyPromise.timeout} = {}) {
|
|
980
998
|
ppidSource = undefined;
|
|
981
999
|
submodules = [];
|
|
982
1000
|
configRegistry = [];
|
|
@@ -1021,10 +1039,10 @@ export function init(config, {delay = delayFor} = {}) {
|
|
|
1021
1039
|
// exposing getUserIds function in global-name-space so that userIds stored in Prebid can be used by external codes.
|
|
1022
1040
|
(getGlobal()).getUserIds = getUserIds;
|
|
1023
1041
|
(getGlobal()).getUserIdsAsEids = getUserIdsAsEids;
|
|
1024
|
-
(getGlobal()).getEncryptedEidsForSource = getEncryptedEidsForSource;
|
|
1042
|
+
(getGlobal()).getEncryptedEidsForSource = normalizePromise(getEncryptedEidsForSource);
|
|
1025
1043
|
(getGlobal()).registerSignalSources = registerSignalSources;
|
|
1026
|
-
(getGlobal()).refreshUserIds = refreshUserIds;
|
|
1027
|
-
(getGlobal()).getUserIdsAsync = getUserIdsAsync;
|
|
1044
|
+
(getGlobal()).refreshUserIds = normalizePromise(refreshUserIds);
|
|
1045
|
+
(getGlobal()).getUserIdsAsync = normalizePromise(getUserIdsAsync);
|
|
1028
1046
|
(getGlobal()).getUserIdsAsEidBySource = getUserIdsAsEidBySource;
|
|
1029
1047
|
}
|
|
1030
1048
|
|
package/package.json
CHANGED
package/src/auction.js
CHANGED
|
@@ -76,6 +76,7 @@ import {bidderSettings} from './bidderSettings.js';
|
|
|
76
76
|
import * as events from './events.js'
|
|
77
77
|
import adapterManager from './adapterManager.js';
|
|
78
78
|
import CONSTANTS from './constants.json';
|
|
79
|
+
import {GreedyPromise} from './utils/promise.js';
|
|
79
80
|
|
|
80
81
|
const { syncUsers } = userSync;
|
|
81
82
|
|
|
@@ -375,9 +376,9 @@ export function auctionCallbacks(auctionDone, auctionInstance, {index = auctionM
|
|
|
375
376
|
|
|
376
377
|
function waitFor(requestId, result) {
|
|
377
378
|
if (ready[requestId] == null) {
|
|
378
|
-
ready[requestId] =
|
|
379
|
+
ready[requestId] = GreedyPromise.resolve();
|
|
379
380
|
}
|
|
380
|
-
ready[requestId] = ready[requestId].then(() =>
|
|
381
|
+
ready[requestId] = ready[requestId].then(() => GreedyPromise.resolve(result).catch(() => {}))
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
function guard(bidderRequest, fn) {
|
|
@@ -389,9 +390,9 @@ export function auctionCallbacks(auctionDone, auctionInstance, {index = auctionM
|
|
|
389
390
|
const wait = ready[bidderRequest.bidderRequestId];
|
|
390
391
|
const orphanWait = ready['']; // also wait for "orphan" responses that are not associated with any request
|
|
391
392
|
if ((wait != null || orphanWait != null) && timeRemaining > 0) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
GreedyPromise.race([
|
|
394
|
+
GreedyPromise.timeout(timeRemaining),
|
|
395
|
+
GreedyPromise.resolve(orphanWait).then(() => wait)
|
|
395
396
|
]).then(fn);
|
|
396
397
|
} else {
|
|
397
398
|
fn();
|
package/src/consentHandler.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {isStr, timestamp} from './utils.js';
|
|
2
|
+
import {defer, GreedyPromise} from './utils/promise.js';
|
|
2
3
|
|
|
3
4
|
export class ConsentHandler {
|
|
4
5
|
#enabled;
|
|
5
6
|
#data;
|
|
6
|
-
#
|
|
7
|
-
#resolve;
|
|
7
|
+
#defer;
|
|
8
8
|
#ready;
|
|
9
9
|
generatedTime;
|
|
10
10
|
|
|
@@ -12,17 +12,17 @@ export class ConsentHandler {
|
|
|
12
12
|
this.reset();
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
#resolve(data) {
|
|
16
|
+
this.#ready = true;
|
|
17
|
+
this.#data = data;
|
|
18
|
+
this.#defer.resolve(data);
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* reset this handler (mainly for tests)
|
|
17
23
|
*/
|
|
18
24
|
reset() {
|
|
19
|
-
this.#
|
|
20
|
-
this.#resolve = (data) => {
|
|
21
|
-
this.#ready = true;
|
|
22
|
-
this.#data = data;
|
|
23
|
-
resolve(data);
|
|
24
|
-
};
|
|
25
|
-
});
|
|
25
|
+
this.#defer = defer();
|
|
26
26
|
this.#enabled = false;
|
|
27
27
|
this.#data = null;
|
|
28
28
|
this.#ready = false;
|
|
@@ -56,12 +56,12 @@ export class ConsentHandler {
|
|
|
56
56
|
*/
|
|
57
57
|
get promise() {
|
|
58
58
|
if (this.#ready) {
|
|
59
|
-
return
|
|
59
|
+
return GreedyPromise.resolve(this.#data);
|
|
60
60
|
}
|
|
61
61
|
if (!this.#enabled) {
|
|
62
62
|
this.#resolve(null);
|
|
63
63
|
}
|
|
64
|
-
return this.#promise;
|
|
64
|
+
return this.#defer.promise;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
setConsentData(data, time = timestamp()) {
|
package/src/hook.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import funHooks from 'fun-hooks/no-eval/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import {defer} from './utils/promise.js';
|
|
3
3
|
|
|
4
4
|
export let hook = funHooks({
|
|
5
5
|
ready: funHooks.SYNC | funHooks.ASYNC | funHooks.QUEUE
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
const readyCtl =
|
|
8
|
+
const readyCtl = defer();
|
|
9
9
|
hook.ready = (() => {
|
|
10
10
|
const ready = hook.ready;
|
|
11
11
|
return function () {
|
package/src/storageManager.js
CHANGED
|
@@ -48,7 +48,7 @@ export function newStorageManager({gvlid, moduleName, bidderCode, moduleType} =
|
|
|
48
48
|
let hookDetails = {
|
|
49
49
|
hasEnforcementHook: false
|
|
50
50
|
}
|
|
51
|
-
validateStorageEnforcement(gvlid, bidderCode || moduleName, hookDetails, function(result) {
|
|
51
|
+
validateStorageEnforcement(gvlid, bidderCode || moduleName, moduleType, hookDetails, function(result) {
|
|
52
52
|
if (result && result.hasEnforcementHook) {
|
|
53
53
|
value = cb(result);
|
|
54
54
|
} else {
|
|
@@ -303,7 +303,7 @@ export function newStorageManager({gvlid, moduleName, bidderCode, moduleType} =
|
|
|
303
303
|
/**
|
|
304
304
|
* This hook validates the storage enforcement if gdprEnforcement module is included
|
|
305
305
|
*/
|
|
306
|
-
export const validateStorageEnforcement = hook('async', function(gvlid, moduleName, hookDetails, callback) {
|
|
306
|
+
export const validateStorageEnforcement = hook('async', function(gvlid, moduleName, moduleType, hookDetails, callback) {
|
|
307
307
|
callback(hookDetails);
|
|
308
308
|
}, 'validateStorageEnforcement');
|
|
309
309
|
|
|
@@ -322,12 +322,13 @@ export function getCoreStorageManager(moduleName) {
|
|
|
322
322
|
* @param {Number=} gvlid? Vendor id - required for proper GDPR integration
|
|
323
323
|
* @param {string=} bidderCode? - required for bid adapters
|
|
324
324
|
* @param {string=} moduleName? module name
|
|
325
|
+
* @param {string=} moduleType? module type
|
|
325
326
|
*/
|
|
326
|
-
export function getStorageManager({gvlid, moduleName, bidderCode} = {}) {
|
|
327
|
+
export function getStorageManager({gvlid, moduleName, bidderCode, moduleType} = {}) {
|
|
327
328
|
if (arguments.length > 1 || (arguments.length > 0 && !isPlainObject(arguments[0]))) {
|
|
328
329
|
throw new Error('Invalid invocation for getStorageManager')
|
|
329
330
|
}
|
|
330
|
-
return newStorageManager({gvlid, moduleName, bidderCode});
|
|
331
|
+
return newStorageManager({gvlid, moduleName, bidderCode, moduleType});
|
|
331
332
|
}
|
|
332
333
|
|
|
333
334
|
export function resetData() {
|