@financial-times/ads-display
Advanced tools
Comparing version 5.2.8 to 5.3.0-beta.1
@@ -593,23 +593,2 @@ import oAds from '@financial-times/ads-legacy-o-ads'; | ||
let oAdsDeviceSpoorId = ""; | ||
const GPT_LAZY_LOAD_DEFAULT = { | ||
980: { | ||
fetchMarginPercent: 30, | ||
// 30%, pre-fetch the ad slightly before rendering | ||
renderMarginPercent: 15, | ||
// 15%, render the ad slightly before rendering | ||
mobileScaling: 1.0 // use same pre-fetch and render margins for mobile | ||
}, | ||
760: { | ||
fetchMarginPercent: 10, | ||
renderMarginPercent: 5, | ||
mobileScaling: 1.0 | ||
} | ||
}; | ||
const GPT_LAZY_LOAD_BREAKPOINT_FALLBACK = { | ||
fetchMarginPercent: 10, | ||
renderMarginPercent: 0, | ||
// when the first slot enters the viewport | ||
mobileScaling: 1.0 | ||
}; | ||
/** | ||
@@ -653,3 +632,3 @@ * Initialise display ads via o-ads | ||
if (pc !== null && pc !== void 0 && (_pc$isAllowed = pc.isAllowed()) !== null && _pc$isAllowed !== void 0 && _pc$isAllowed.all) { | ||
if (pc !== null && pc !== void 0 && (_pc$isAllowed = pc.isAllowed()) !== null && _pc$isAllowed !== void 0 && _pc$isAllowed.all || flags.get("adsDisableInternalCMP")) { | ||
displayAds.pushGooglePpid(oAdsDeviceSpoorId); | ||
@@ -748,9 +727,7 @@ } | ||
* @param {Object} options - Options used to initialise displayAds.init(options) | ||
* @param {Object} flags - Flags object | ||
*/ | ||
function getOAdsConfig(options, flags = { | ||
get: () => undefined | ||
}) { | ||
function getOAdsConfig(options) { | ||
const { | ||
@@ -769,7 +746,4 @@ lazyLoadMargins, | ||
// enable single request architecture https://support.google.com/admanager/answer/183282 | ||
rendering: flags.get("adsEnableSRA") ? "sra" : null, | ||
enableLazyLoad: flags.get("adsEnableGPTLazyLoad") ? calculateViewportMargin({ | ||
breakpointMargins: lazyLoadMargins || GPT_LAZY_LOAD_DEFAULT, | ||
fallbackValue: GPT_LAZY_LOAD_BREAKPOINT_FALLBACK | ||
}) : null | ||
rendering: null, | ||
enableLazyLoad: null | ||
}, | ||
@@ -803,3 +777,3 @@ formats: { | ||
collapseEmpty: "before", | ||
lazyLoad: !flags.get("adsEnableGPTLazyLoad") && { | ||
lazyLoad: { | ||
viewportMargin: calculateViewportMargin({ | ||
@@ -893,2 +867,3 @@ breakpointMargins: lazyLoadMargins | ||
* rootId: Object; | ||
* internalCmp: boolean; | ||
* }} props | ||
@@ -902,9 +877,23 @@ * @returns {Promise<boolean>} true if permutive has been setup, | ||
type, | ||
rootId | ||
rootId, | ||
internalCmp | ||
}) { | ||
var _pc$isAllowed; | ||
const pc = await _getPersonalisedConsent(); | ||
/** | ||
* Helper function for the interim period while both the internal FT CMP and the new Vendor CMP are in use on FT.com | ||
* Function uses the `internalCmp` argument passed to the exported parent function. This parameter will be derived from | ||
* a flag value `adsDisableInternalCMP` in the upstream apps. | ||
* Note that in the case we are using the new vendor, either pc?.isAllowed.permutive or pc?.isAllowed()?.behavioral being true | ||
* will be treated as consent for Permutive having been given. This is to cater for cases where a user has an existing consent-cookie | ||
* but the new CMP is in use. | ||
* @returns boolean | ||
*/ | ||
if (pc !== null && pc !== void 0 && (_pc$isAllowed = pc.isAllowed()) !== null && _pc$isAllowed !== void 0 && _pc$isAllowed.behavioral) { | ||
const backwardsCompatibleConsent = () => { | ||
var _pc$isAllowed, _pc$isAllowed2; | ||
return internalCmp ? pc === null || pc === void 0 ? void 0 : (_pc$isAllowed = pc.isAllowed()) === null || _pc$isAllowed === void 0 ? void 0 : _pc$isAllowed.behavioral : (pc === null || pc === void 0 ? void 0 : pc.isAllowed.permutive) || (pc === null || pc === void 0 ? void 0 : (_pc$isAllowed2 = pc.isAllowed()) === null || _pc$isAllowed2 === void 0 ? void 0 : _pc$isAllowed2.behavioral); | ||
}; | ||
if (backwardsCompatibleConsent()) { | ||
setupPermutive({ | ||
@@ -911,0 +900,0 @@ metadata, |
@@ -5,3 +5,3 @@ { | ||
"type": "module", | ||
"version": "5.2.8", | ||
"version": "5.3.0-beta.1", | ||
"typings": "./types.d.ts", | ||
@@ -19,6 +19,6 @@ "files": [ | ||
"dependencies": { | ||
"@financial-times/ads-legacy-o-ads": "^5.2.8", | ||
"@financial-times/ads-moat-integration": "^5.2.8", | ||
"@financial-times/ads-permutive": "^5.2.8", | ||
"@financial-times/ads-personalised-consent": "^5.2.8", | ||
"@financial-times/ads-legacy-o-ads": "^5.3.0-beta.1", | ||
"@financial-times/ads-moat-integration": "^5.3.0-beta.1", | ||
"@financial-times/ads-permutive": "^5.3.0-beta.1", | ||
"@financial-times/ads-personalised-consent": "^5.3.0-beta.1", | ||
"@financial-times/n-tracking": "^4.0.1", | ||
@@ -25,0 +25,0 @@ "@financial-times/o-tracking": "^4.0.0", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
47460
884
2