forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: improve FPD enrichment (prebid#9659)
* Move sua logic to core * Improve FPD enrichment: merge in `setConfig({app, device, site})`; leave only one of `dooh`, `app`, `site`; enrich the one left with `domain` / `publisher`
- Loading branch information
1 parent
2d685eb
commit 9107b2b
Showing
9 changed files
with
242 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {logWarn} from '../utils.js'; | ||
|
||
// mutually exclusive ORTB sections in order of priority - 'dooh' beats 'app' & 'site' and 'app' beats 'site'; | ||
// if one is set, the others will be removed | ||
export const CLIENT_SECTIONS = ['dooh', 'app', 'site'] | ||
|
||
export function clientSectionChecker(logPrefix) { | ||
return function onlyOneClientSection(ortb2) { | ||
CLIENT_SECTIONS.reduce((found, section) => { | ||
if (hasSection(ortb2, section)) { | ||
if (found != null) { | ||
logWarn(`${logPrefix} specifies both '${found}' and '${section}'; dropping the latter.`) | ||
delete ortb2[section]; | ||
} else { | ||
found = section; | ||
} | ||
} | ||
return found; | ||
}, null); | ||
return ortb2; | ||
} | ||
} | ||
|
||
export function hasSection(ortb2, section) { | ||
return ortb2[section] != null && Object.keys(ortb2[section]).length > 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.