@financial-times/ads-display
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -1,7 +0,8 @@ | ||
import oTracking from '@financial-times/o-tracking/dist/javascript/core.js'; | ||
import oTracking from '@financial-times/o-tracking'; | ||
import oAds from '@financial-times/ads-legacy-o-ads'; | ||
import { broadcast } from '@financial-times/n-tracking'; | ||
import { getUsPrivacyForTracking, setUSPrivacy } from '@financial-times/privacy-us-privacy'; | ||
import adsPermutive from '@financial-times/ads-permutive/src/client'; | ||
export { default as adsPermutive } from '@financial-times/ads-permutive/src/client'; | ||
import moatIntegration from '@financial-times/ads-moat-integration'; | ||
import adsPermutive from '@financial-times/ads-permutive'; | ||
export { default as adsPermutive } from '@financial-times/ads-permutive'; | ||
@@ -532,4 +533,3 @@ /** | ||
if (options.waitForMoat) { | ||
return waitForMoat(1000) | ||
.finally(() => displayAds.initAdSlots(oAdsInstance)) | ||
moatIntegration(); | ||
} | ||
@@ -687,53 +687,2 @@ | ||
/** | ||
* Add the moat script to the page. This will add an extra targeting | ||
* parameter to the ad call `m_data`. This will be 0 if the traffic | ||
* is deemed valid, 1 if not. It will also be `waiting` if the ad request | ||
* is sent before the moat script has had a chance to set `m_data`. It's a | ||
* race between moat script and gpt script to send ad request, so first ad | ||
* may not always have the `m_data` param to check for invalid traffic | ||
*/ | ||
function validateTraffic(deferScript = true, cb = () => null) { | ||
const existingScript = document.getElementById('n-ads-moat'); | ||
if (existingScript) { | ||
return | ||
} | ||
const script = document.createElement('script'); | ||
script.defer = deferScript; | ||
script.src = 'https://sejs.moatads.com/financialtimesprebidheader859796398452/yi.js'; | ||
script.id = 'n-ads-moat'; | ||
script.onload = () => { | ||
perfMark('oAds.IVTComplete'); | ||
cb(); | ||
}; | ||
script.onerror = () => { | ||
perfMark('oAds.IVTComplete'); | ||
cb(); | ||
}; | ||
document.head.appendChild(script); | ||
} | ||
function waitForMoat (timeout) { | ||
return new Promise((resolve, reject) => { | ||
const checkMoatInterval = setInterval(() => { | ||
if(window.moatPrebidApi && | ||
typeof window.moatPrebidApi.slotDataAvailable === "function" && | ||
window.moatPrebidApi.slotDataAvailable() && | ||
window.moatPrebidApi.safetyDataAvailable() | ||
) { | ||
window.moatPrebidApi.setMoatTargetingForAllSlots(); | ||
clearInterval(checkMoatInterval); | ||
clearTimeout(timeoutId); | ||
resolve(); | ||
} | ||
}, 50); | ||
const timeoutId = setTimeout(() => { | ||
clearInterval(checkMoatInterval); | ||
reject(); | ||
}, timeout); | ||
}); | ||
} | ||
// Necessary for testing | ||
@@ -747,5 +696,3 @@ const displayAds = { | ||
getGptSite, | ||
getGptZone, | ||
validateTraffic, | ||
waitForMoat | ||
getGptZone | ||
}; | ||
@@ -752,0 +699,0 @@ |
{ | ||
"name": "@financial-times/ads-display", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Bring ads to your page with the FT specific o-ads configuration", | ||
@@ -40,7 +40,8 @@ "browser": "dist/client.js", | ||
"dependencies": { | ||
"@financial-times/ads-permutive": "^2.1.0", | ||
"@financial-times/n-tracking": "1.4.0", | ||
"@financial-times/ads-legacy-o-ads": "^2.1.0", | ||
"@financial-times/o-tracking": "^2.0.3", | ||
"@financial-times/privacy-us-privacy": "^1.0.0" | ||
"@financial-times/ads-legacy-o-ads": "^2.2.0", | ||
"@financial-times/ads-permutive": "^2.2.0", | ||
"@financial-times/n-tracking": "4.0.0", | ||
"@financial-times/o-tracking": "^4.0.0", | ||
"@financial-times/privacy-us-privacy": "^1.0.0", | ||
"@financial-times/ads-moat-integration": "^2.2.0" | ||
}, | ||
@@ -51,2 +52,3 @@ "devDependencies": { | ||
"@babel/preset-env": "^7.4.5", | ||
"browser-resolve": "^2.0.0", | ||
"eslint": "^7.0.0", | ||
@@ -57,2 +59,3 @@ "eslint-import-resolver-webpack": "^0.13.0", | ||
"jest": "^26.0.0", | ||
"jest-environment-jsdom-global": "^2.0.4", | ||
"jest-fetch-mock": "^3.0.3", | ||
@@ -59,0 +62,0 @@ "lint-staged": "^10.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
460
17
59864
8
20
1090
+ Added@financial-times/ads-moat-integration@2.2.0(transitive)
+ Added@financial-times/n-tracking@4.0.0(transitive)
+ Added@financial-times/o-tracking@3.2.04.6.1(transitive)
+ Addedftdomdelegate@5.0.0(transitive)
- Removed@financial-times/n-tracking@1.4.0(transitive)
- Removed@financial-times/o-tracking@2.0.10(transitive)