Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Komorski authored and Marcin Komorski committed Jul 11, 2024
1 parent 42aefd7 commit fb9a5a1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
7 changes: 7 additions & 0 deletions libraries/dfpUtils/dfpUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ export const DFP_ENDPOINT = {
host: 'securepubads.g.doubleclick.net',
pathname: '/gampad/ads'
}

export const setGdprConsent = (gdprConsent, queryParams) => {
if (!gdprConsent) { return; }
if (typeof gdprConsent.gdprApplies === 'boolean') { queryParams.gdpr = Number(gdprConsent.gdprApplies); }
if (gdprConsent.consentString) { queryParams.gdpr_consent = gdprConsent.consentString; }
if (gdprConsent.addtlConsent) { queryParams.addtl_consent = gdprConsent.addtlConsent; }
}
8 changes: 2 additions & 6 deletions modules/dfpAdServerVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This module adds [DFP support]{@link https://www.doubleclickbygoogle.com/} for Video to Prebid.
*/

import { DEFAULT_DFP_PARAMS, DFP_ENDPOINT } from '../libraries/dfpUtils/dfpUtils.js';
import { DEFAULT_DFP_PARAMS, DFP_ENDPOINT, setGdprConsent } from '../libraries/dfpUtils/dfpUtils.js';
import { getSignals } from '../libraries/gptUtils/gptUtils.js';
import { registerVideoSupport } from '../src/adServerManager.js';
import { gdprDataHandler } from '../src/adapterManager.js';
Expand Down Expand Up @@ -114,11 +114,7 @@ export function buildDfpVideoUrl(options) {
const descriptionUrl = getDescriptionUrl(bid, options, 'params');
if (descriptionUrl) { queryParams.description_url = descriptionUrl; }
const gdprConsent = gdprDataHandler.getConsentData();
if (gdprConsent) {
if (typeof gdprConsent.gdprApplies === 'boolean') { queryParams.gdpr = Number(gdprConsent.gdprApplies); }
if (gdprConsent.consentString) { queryParams.gdpr_consent = gdprConsent.consentString; }
if (gdprConsent.addtlConsent) { queryParams.addtl_consent = gdprConsent.addtlConsent; }
}
setGdprConsent(gdprConsent, queryParams);

if (!queryParams.ppid) {
const ppid = getPPID();
Expand Down
8 changes: 2 additions & 6 deletions modules/dfpAdpod.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {submodule} from '../src/hook.js';
import {buildUrl, deepAccess, formatQS, logError, parseSizesInput} from '../src/utils.js';
import {auctionManager} from '../src/auctionManager.js';
import {DEFAULT_DFP_PARAMS, DFP_ENDPOINT} from '../libraries/dfpUtils/dfpUtils.js';
import {DEFAULT_DFP_PARAMS, DFP_ENDPOINT, setGdprConsent} from '../libraries/dfpUtils/dfpUtils.js';
import {gdprDataHandler} from '../src/consentHandler.js';
import {registerVideoSupport} from '../src/adServerManager.js';

Expand Down Expand Up @@ -79,11 +79,7 @@ export function buildAdpodVideoUrl({code, params, callback} = {}) {
);

const gdprConsent = gdprDataHandler.getConsentData();
if (gdprConsent) {
if (typeof gdprConsent.gdprApplies === 'boolean') { queryParams.gdpr = Number(gdprConsent.gdprApplies); }
if (gdprConsent.consentString) { queryParams.gdpr_consent = gdprConsent.consentString; }
if (gdprConsent.addtlConsent) { queryParams.addtl_consent = gdprConsent.addtlConsent; }
}
setGdprConsent(gdprConsent, queryParams);

const masterTag = buildUrl({
...DFP_ENDPOINT,
Expand Down
2 changes: 1 addition & 1 deletion src/targeting.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function sortByDealAndPriceBucketOrCpm(useCpm = false) {
* @param {Array<String>} adUnitCodes
* @param customSlotMatching
* @param getSlots
* @return {{[p: string]: any}}
* @return {Object.<string,any>}
*/
export function getGPTSlotsForAdUnits(adUnitCodes, customSlotMatching, getSlots = () => window.googletag.pubads().getSlots()) {
return getSlots().reduce((auToSlots, slot) => {
Expand Down

0 comments on commit fb9a5a1

Please sign in to comment.