@financial-times/cmp-client 5.1.1 → 5.2.0
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/index.cjs
CHANGED
|
@@ -472,6 +472,7 @@ function parseCaliforniaSection(sectionData) {
|
|
|
472
472
|
function parseUsNationalSection(sectionData) {
|
|
473
473
|
const { SaleOptOut, SharingOptOut, TargetedAdvertisingOptOut } = sectionData;
|
|
474
474
|
const { excludedCategories } = sectionConfig[sections.US_NATIONAL];
|
|
475
|
+
const marketingOptOutStatus = JSON.parse(localStorage.getItem("ft_sp_marketing_optout") || "{}");
|
|
475
476
|
const userHasNotOptedOut = SaleOptOut !== 1 && SharingOptOut !== 1 && TargetedAdvertisingOptOut !== 1;
|
|
476
477
|
const parsedConsent = {};
|
|
477
478
|
for (const categoryName of iabCategoryNames) {
|
|
@@ -481,6 +482,10 @@ function parseUsNationalSection(sectionData) {
|
|
|
481
482
|
}
|
|
482
483
|
parsedConsent[categoryName] = userHasNotOptedOut;
|
|
483
484
|
}
|
|
485
|
+
if (marketingOptOutStatus.usnat) {
|
|
486
|
+
parsedConsent.personalisedMarketing = false;
|
|
487
|
+
parsedConsent.behaviouralAds = false;
|
|
488
|
+
}
|
|
484
489
|
return parsedConsent;
|
|
485
490
|
}
|
|
486
491
|
const sectionParsers = {
|
|
@@ -798,7 +803,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
798
803
|
false
|
|
799
804
|
);
|
|
800
805
|
}
|
|
801
|
-
const version = "5.
|
|
806
|
+
const version = "5.2.0";
|
|
802
807
|
async function initSourcepointCmp(options) {
|
|
803
808
|
const {
|
|
804
809
|
useFTSession = true,
|
package/dist/index.js
CHANGED
|
@@ -470,6 +470,7 @@ function parseCaliforniaSection(sectionData) {
|
|
|
470
470
|
function parseUsNationalSection(sectionData) {
|
|
471
471
|
const { SaleOptOut, SharingOptOut, TargetedAdvertisingOptOut } = sectionData;
|
|
472
472
|
const { excludedCategories } = sectionConfig[sections.US_NATIONAL];
|
|
473
|
+
const marketingOptOutStatus = JSON.parse(localStorage.getItem("ft_sp_marketing_optout") || "{}");
|
|
473
474
|
const userHasNotOptedOut = SaleOptOut !== 1 && SharingOptOut !== 1 && TargetedAdvertisingOptOut !== 1;
|
|
474
475
|
const parsedConsent = {};
|
|
475
476
|
for (const categoryName of iabCategoryNames) {
|
|
@@ -479,6 +480,10 @@ function parseUsNationalSection(sectionData) {
|
|
|
479
480
|
}
|
|
480
481
|
parsedConsent[categoryName] = userHasNotOptedOut;
|
|
481
482
|
}
|
|
483
|
+
if (marketingOptOutStatus.usnat) {
|
|
484
|
+
parsedConsent.personalisedMarketing = false;
|
|
485
|
+
parsedConsent.behaviouralAds = false;
|
|
486
|
+
}
|
|
482
487
|
return parsedConsent;
|
|
483
488
|
}
|
|
484
489
|
const sectionParsers = {
|
|
@@ -796,7 +801,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
796
801
|
false
|
|
797
802
|
);
|
|
798
803
|
}
|
|
799
|
-
const version = "5.
|
|
804
|
+
const version = "5.2.0";
|
|
800
805
|
async function initSourcepointCmp(options) {
|
|
801
806
|
const {
|
|
802
807
|
useFTSession = true,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";var M,L;const R=(e,{credentials:n="omit"}={})=>fetch(`https://session-next.ft.com${e}`,{credentials:n,useCorsProxy:!0}).then(t=>t.ok?t.json():t.text().then(o=>{throw new Error(`Next session responded with "${o}" (${t.status})`)})).catch(t=>{document.body.dispatchEvent(new CustomEvent("oErrors.log",{bubbles:!0,detail:{error:t,info:{component:"next-session-client"}}}))});let _={};const I=(e,n)=>{if(typeof e=="object"){_=e;return}if(typeof e=="string"&&typeof n=="string"){_[e]=n;return}if(typeof e=="string"&&typeof n>"u")return _[e]||null;if(typeof e>"u"&&typeof n>"u")return _;throw new Error("Invalid arguments")};I.clear=()=>{_={}};const v={},F=()=>{const[,e]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return e},U=()=>{const e=I("uuid");if(e)return Promise.resolve({uuid:e});const n=F();return n?(v.uuid||(v.uuid=R(`/sessions/s/${n}`).then(({uuid:t}={})=>(delete v.uuid,t&&I("uuid",t),{uuid:t}))),v.uuid):Promise.resolve({uuid:void 0})},O="sourcepoint-cmp",V="FTPINK",x="FTConsent",j="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",H=".ft.com",q="https://consent.ft.com",E={permutiveAds:{purposes:[2,4,8,9],iabVendors:[361],customVendors:[],specialFeatures:[]},demographicAds:{purposes:[7,9,10],iabVendors:[],customVendors:[],specialFeatures:[]},behaviouralAds:{purposes:[2,4,8,9],iabVendors:[],customVendors:[],specialFeatures:[]},programmaticAds:{purposes:[2],iabVendors:[],customVendors:[],specialFeatures:[]},personalisedMarketing:{purposes:[2,7,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]}},C=Object.keys(E),d={joinHref:!0,gdpr:{}},
|
|
2
|
-
`};function ne(e){const n=document.createDocumentFragment();return n.appendChild(
|
|
1
|
+
(function(){"use strict";var M,L;const R=(e,{credentials:n="omit"}={})=>fetch(`https://session-next.ft.com${e}`,{credentials:n,useCorsProxy:!0}).then(t=>t.ok?t.json():t.text().then(o=>{throw new Error(`Next session responded with "${o}" (${t.status})`)})).catch(t=>{document.body.dispatchEvent(new CustomEvent("oErrors.log",{bubbles:!0,detail:{error:t,info:{component:"next-session-client"}}}))});let _={};const I=(e,n)=>{if(typeof e=="object"){_=e;return}if(typeof e=="string"&&typeof n=="string"){_[e]=n;return}if(typeof e=="string"&&typeof n>"u")return _[e]||null;if(typeof e>"u"&&typeof n>"u")return _;throw new Error("Invalid arguments")};I.clear=()=>{_={}};const v={},F=()=>{const[,e]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return e},U=()=>{const e=I("uuid");if(e)return Promise.resolve({uuid:e});const n=F();return n?(v.uuid||(v.uuid=R(`/sessions/s/${n}`).then(({uuid:t}={})=>(delete v.uuid,t&&I("uuid",t),{uuid:t}))),v.uuid):Promise.resolve({uuid:void 0})},O="sourcepoint-cmp",V="FTPINK",x="FTConsent",j="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",H=".ft.com",q="https://consent.ft.com",E={permutiveAds:{purposes:[2,4,8,9],iabVendors:[361],customVendors:[],specialFeatures:[]},demographicAds:{purposes:[7,9,10],iabVendors:[],customVendors:[],specialFeatures:[]},behaviouralAds:{purposes:[2,4,8,9],iabVendors:[],customVendors:[],specialFeatures:[]},programmaticAds:{purposes:[2],iabVendors:[],customVendors:[],specialFeatures:[]},personalisedMarketing:{purposes:[2,7,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]}},C=Object.keys(E),d={joinHref:!0,gdpr:{}},k={...d,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyHref:"https://local.ft.com",_clientOptions:{privacyManagerId:827767,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies",rootDomain:"ft.com"}},y={...d,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyId:31642,_clientOptions:{privacyManagerId:827767,usnatPrivacyManagerId:1143274,ccpaPrivacyManagerId:944882,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies",rootDomain:"ft.com"}},G={...d,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com"}},$={...d,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com"}},W={...d,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com"}},J={...d,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com"}},K={...d,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com"}},B={...d,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com"}},X={...d,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk"}},Y={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},z={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},Z={...d,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com"}},Q=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:y,FT_DOTCOM_TEST:k,MM_IGNITES_ASIA:Y,MM_IGNITES_EUROPE:z,SP_BANKING_RR:J,SP_FDI_INTELLIGENCE:$,SP_FT_ADVISER:B,SP_INVESTORS_CHRONICLE:X,SP_MANDATE_WIRE:Z,SP_PWMNET:G,SP_SUSTAINABLE_VIEWS:K,SP_THE_BANKER:W},Symbol.toStringTag,{value:"Module"}));function T(e,n){const t=document.createElement("script");return t.dataset.cmpScript=e,t.innerHTML=n,t}function ee(e){const n=document.createElement("script");return n.src=e,n}const te={cmpFrames:"https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"},N={tcfStub:'"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){var t=function(){var t,e,o=[],n=window,r=n;for(;r;){try{if(r.frames.__tcfapiLocator){t=r;break}}catch(t){}if(r===n.top)break;r=r.parent}t||(!function t(){var e=n.document,o=!!n.frames.__tcfapiLocator;if(!o)if(e.body){var r=e.createElement("iframe");r.style.cssText="display:none",r.name="__tcfapiLocator",r.title = "__tcfapiLocator",e.body.appendChild(r)}else setTimeout(t,5);return!o}(),n.__tcfapi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return o;"setGdprApplies"===n[0]?n.length>3&&2===parseInt(n[1],10)&&"boolean"==typeof n[3]&&(e=n[3],"function"==typeof n[2]&&n[2]("set",!0)):"ping"===n[0]?"function"==typeof n[2]&&n[2]({gdprApplies:e,cmpLoaded:!1,cmpStatus:"stub"}):o.push(n)},n.addEventListener("message",(function(t){var e="string"==typeof t.data,o={};if(e)try{o=JSON.parse(t.data)}catch(t){}else o=t.data;var n="object"===_typeof(o)&&null!==o?o.__tcfapiCall:null;n&&window.__tcfapi(n.command,n.version,(function(o,r){var a={__tcfapiReturn:{returnValue:o,success:r,callId:n.callId}};t&&t.source&&t.source.postMessage&&t.source.postMessage(e?JSON.stringify(a):a,"*")}),n.parameter)}),!1))};"undefined"!=typeof module?module.exports=t:t()}();',gppStub:`window.__gpp_addFrame=function(e){if(!window.frames[e])if(document.body){var t=document.createElement("iframe");t.style.cssText="display:none",t.name=e,document.body.appendChild(t)}else window.setTimeout(window.__gpp_addFrame,10,e)},window.__gpp_stub=function(){var e=arguments;if(__gpp.queue=__gpp.queue||[],__gpp.events=__gpp.events||[],!e.length||1==e.length&&"queue"==e[0])return __gpp.queue;if(1==e.length&&"events"==e[0])return __gpp.events;var t=e[0],p=e.length>1?e[1]:null,s=e.length>2?e[2]:null;if("ping"===t)p({gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}},!0);else if("addEventListener"===t){"lastId"in __gpp||(__gpp.lastId=0),__gpp.lastId++;var n=__gpp.lastId;__gpp.events.push({id:n,callback:p,parameter:s}),p({eventName:"listenerRegistered",listenerId:n,data:!0,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else if("removeEventListener"===t){for(var a=!1,i=0;i<__gpp.events.length;i++)if(__gpp.events[i].id==s){__gpp.events.splice(i,1),a=!0;break}p({eventName:"listenerRemoved",listenerId:s,data:a,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else"hasSection"===t?p(!1,!0):"getSection"===t||"getField"===t?p(null,!0):__gpp.queue.push([].slice.apply(e))},window.__gpp_msghandler=function(e){var t="string"==typeof e.data;try{var p=t?JSON.parse(e.data):e.data}catch(e){p=null}if("object"==typeof p&&null!==p&&"__gppCall"in p){var s=p.__gppCall;window.__gpp(s.command,(function(p,n){var a={__gppReturn:{returnValue:p,success:n,callId:s.callId}};e.source.postMessage(t?JSON.stringify(a):a,"*")}),"parameter"in s?s.parameter:null,"version"in s?s.version:"1.1")}},"__gpp"in window&&"function"==typeof window.__gpp||(window.__gpp=window.__gpp_stub,window.addEventListener("message",window.__gpp_msghandler,!1),window.__gpp_addFrame("__gppLocator"));
|
|
2
|
+
`};function ne(e){const n=document.createDocumentFragment();return n.appendChild(T("tcf",N.tcfStub)),e.includeUsNat&&n.appendChild(T("gpp",N.gppStub)),n.appendChild(ee(te.cmpFrames)),n}function oe(e,n){const{userId:t,includeUsNat:o}=n;return t&&(e.authId=t),o&&(e.usnat=e.usnat||{}),e}function se(e,n){const{_clientOptions:t,...o}=e,s=oe(o,n);window._sp_={config:s},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(ne(n))}function re(e,n,{formOfWordsId:t,cookieDomain:o}){const r=Object.keys(e).reduce((a,i)=>(a[i]={onsite:{status:e[i],lbi:!1,source:O,fow:t}},a),{});return n?{setConsentCookie:!0,formOfWordsId:t,consentSource:O,cookieDomain:o,data:r}:{data:r,cookieDomain:o}}const m={CALIFORNIA:"uscav1",US_NATIONAL:"usnatv1"},P={[m.CALIFORNIA]:{excludedCategories:{personalisedMarketing:!0}},[m.US_NATIONAL]:{excludedCategories:{personalisedMarketing:!0}}};function ae(e){const{applicableSections:n,supportedAPIs:t}=e,o=n[0];if(o===-1||typeof o>"u")return;const s=t.find(a=>a.startsWith(`${o}:`));return s==null?void 0:s.split(":")[1]}function ie(e){const{SaleOptOut:n,SharingOptOut:t,Gpc:o}=e,{excludedCategories:s}=P[m.CALIFORNIA],r=n!==1&&t!==1&&!o,a={};for(const i of C){if(i in s){a[i]=!0;continue}a[i]=r}return a}function ce(e){const{SaleOptOut:n,SharingOptOut:t,TargetedAdvertisingOptOut:o}=e,{excludedCategories:s}=P[m.US_NATIONAL],r=JSON.parse(localStorage.getItem("ft_sp_marketing_optout")||"{}"),a=n!==1&&t!==1&&o!==1,i={};for(const c of C){if(c in s){i[c]=!0;continue}i[c]=a}return r.usnat&&(i.personalisedMarketing=!1,i.behaviouralAds=!1),i}const pe={[m.CALIFORNIA]:ie,[m.US_NATIONAL]:ce};async function ue(){const e=await new Promise((a,i)=>{try{window.__gpp?window.__gpp("ping",a):i(new Error("GPP API is not available on page"))}catch(c){i(c)}}),{parsedSections:n}=e,t=ae(e);if(!t||!n[t])throw new Error("GPP parser was called without an applicable section");const o=n[t],s=pe[t];if(!s||typeof s!="function")throw new Error(`No parser found for applicable GPP section: ${t}`);return s(o)}function de(e,{purpose:n,vendor:t,specialFeatureOptins:o}){const s=E[e],r=s.purposes.every(c=>(n==null?void 0:n.consents[c])||(n==null?void 0:n.legitimateInterests[c])),a=s.iabVendors.every(c=>(t==null?void 0:t.consents[c])||(t==null?void 0:t.legitimateInterests[c])),i=s.specialFeatures.every(c=>(o==null?void 0:o[c])===!0);return r&&a&&i}async function le(){const e=await new Promise((t,o)=>{try{window.__tcfapi?window.__tcfapi("addEventListener",2,t):o(new Error("TCF API is not available on page"))}catch(s){o(s)}}),n={};for(const t of C)n[t]=de(t,e);return n}async function fe(e){const t={gdpr:le,usnat:ue}[e];if(!t)throw new Error("Unable to update user consent. Unsupported consent legislation.");return t()}function ge(){const n=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[x];if(!n)return{};const t=decodeURIComponent(n);return Object.fromEntries(t.split(",").map(o=>{const[s,r]=o.split(":");return[s,r==="on"]}))}function me(e,n){return Object.keys(e).some(o=>{const s=`${o.toLowerCase()}Onsite`;return e[o]!==n[s]})}function _e({userId:e,useConsentStore:n}){return!!e&&n===!0}function ve(e,n){return e?`${n.consentProxyHost}/__consent/consent-record/${V}/${n.userId}`:`${n.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${n.cookieDomain}`}async function ye(e,n){try{const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),credentials:"include"});t.ok||console.error("Unable to save consent preferences",t.status)}catch(t){console.error("An error occurred while saving consent",t)}}function we(e){return async function(t,o,s,r){if(e.disableFTCookies||!e.includeUsNat&&t==="usnat")return;const a=r.applies?t:"gdpr";if(a!==t||!s)return;let i;try{i=await fe(a)}catch(g){console.error(g)}if(!i||!me(i,ge()))return;const p=_e(e),f=ve(p,e),u=re(i,p,e);await ye(f,u),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const b="cookie-message",Ie="manage-cookies";let h=Object.freeze({activeComponent:b,messageId:0,privacyManagerId:0});function Ce(e){return typeof e=="object"&&e!==null&&e.constructor===Object&&Object.prototype.toString.call(e)==="[object Object]"}const be=()=>({...h}),S=e=>{if(!Ce(e)){console.error("Invalid state changes");return}h={...h,...e}},he=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function Se(e,n){const t=Oe(e.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[r,a]of Object.entries(ke))(s=(o=window._sp_).addEventListener)==null||s.call(o,r,a({...e,flags:t}))}),Te({...e,flags:t},n)}function Oe(e){const n={};return typeof e=="object"&&he.forEach(t=>{Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}),n}function Ee(e){if(!e)return;const n=document.body,t=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:e.detail});n.dispatchEvent(t)}function w({trackingProps:e,action:n,triggerAction:t}){let o;const s=be(),{product:r,app:a,flags:i}=e;s.activeComponent===b?o=s.messageId:o=s.privacyManagerId;const c={detail:{component:{id:o,name:s.activeComponent,type:"overlay",subtype:"cmp"},category:"component",action:n,...t&&{trigger_action:t},...r&&{product:r},...a&&{app:a},custom:[{cookie_toggle_flag:i}],url:window.document.location.href||null}};Ee(c)}const ke={onMessageChoiceSelect:e=>(n,t,o)=>{const r={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];r&&w({trackingProps:e,action:"click",triggerAction:r})},onMessageReady:e=>()=>{w({trackingProps:e,action:"view"})},onMessageReceiveData:()=>(e,n)=>{const{messageId:t}=n;t&&S({messageId:t})},onError:e=>(n,t)=>{w({trackingProps:e,action:"error",triggerAction:t})},onPMCancel:()=>()=>{S({activeComponent:b})}};function Te(e,n){window.addEventListener("message",function(t){if(t.origin!==n)return;const o={1:"save_and_close",11:"accept_all",13:"reject_all"},{data:{fromPM:s,actionType:r,messageId:a="0"}={}}=t;s&&(+a&&S({activeComponent:Ie,privacyManagerId:+a}),!(!r||!o[r])&&w({trackingProps:e,action:"click",triggerAction:o[r]}))},!1)}const Ne="5.2.0";async function Pe(e){const{useFTSession:n=!0,consentProxyHost:t=q,cookieDomain:o=H,formOfWordsId:s=j,useConsentStore:r=!0,trackingContext:a={},disableFTCookies:i=!1,includeUsNat:c=!1}=e||{};let{propertyConfig:p=y,userId:f}=e||{};if(typeof window>"u"){console.error("The CMP client can only be initialised in a browser context");return}if(window.FT_CMP_CLIENT_VERSION=Ne,!f&&n)try{const u=await U();f=u==null?void 0:u.uuid}catch(u){console.error(u)}p=Ae(p),se(p,{userId:f,includeUsNat:c}),window._sp_queue.push(()=>{var u,g;(g=(u=window._sp_)==null?void 0:u.addEventListener)==null||g.call(u,"onConsentReady",we({userId:f,consentProxyHost:t,cookieDomain:o,formOfWordsId:s,useConsentStore:r,disableFTCookies:i,includeUsNat:c}))}),Se(a,p.baseEndpoint)}function Ae(e){if(!(e!=null&&e.accountId))throw new Error("Please pass a valid property config");return e.events&&(console.warn("[cmp-client] Passing an events map in the config is not supported and will be ignored. Please use window._sp_.addEventListener() to listen for events"),delete e.events),e}function A(e,n,t,o,s,r){const{text:a,onClick:i}=o[n],c=document.querySelectorAll(`a[href*="${r}"]`);for(const p of c)(t||e)&&(s.has(p)&&p.removeEventListener("click",s.get(p)),p.innerText=a,p.addEventListener("click",i),s.set(p,i))}function Me({_clientOptions:e}=y){const{privacyManagerId:n,ccpaPrivacyManagerId:t,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=e??y._clientOptions,r={usnat:{text:"Do not sell my data",onClick:c=>{var p;c.preventDefault(),(p=window._sp_.usnat)==null||p.loadPrivacyManagerModal(o)}},ccpa:{text:"Do not sell my data",onClick:c=>{var p;c.preventDefault(),(p=window._sp_.ccpa)==null||p.loadPrivacyManagerModal(t)}},gdpr:{text:"Manage Cookies",onClick:c=>{var p;c.preventDefault(),(p=window._sp_.gdpr)==null||p.loadPrivacyManagerModal(n)}}},a=new Map,i=function(c,p,f,u){A(!1,c,u.applies,r,a,s),u.applies&&window._sp_queue.push(()=>{var g,D;(D=(g=window._sp_).removeEventListener)==null||D.call(g,"onConsentReady",i)})};A(!0,"gdpr",!1,r,a,s),window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var c,p;(p=(c=window._sp_).addEventListener)==null||p.call(c,"onConsentReady",i)})}function Le(e){const n=document.querySelector(e);return n?JSON.parse(n.textContent||"{}"):{}}function De(){return{flags:Le("script#page-kit-flags-embed")}}function Re(e){const{includeUsNat:n}=e._clientOptions||{},{flags:t}=De();return t!=null&&t.adsEnableGpp||n?{includeUsNat:!0}:{}}const Fe={"ft.com":Re};function Ue(e){const{rootDomain:n}=e._clientOptions||{};if(!n)return{};const t=Fe[n];return!t||typeof t!="function"?{}:t(e)}function Ve(e,n){if(!n||Number.isFinite(parseFloat(n))||!e.endsWith(n))return!1;const t=e.indexOf(n),o=e[t-1];return o==="."||o===void 0}function xe(e){if(!e)throw new Error("Invalid hostname provided");let t=Object.values(Q).find(o=>{var r;if(o.propertyHref)return!1;const s=(r=o._clientOptions)==null?void 0:r.rootDomain;return s&&Ve(e,s)});return t??(t=k),t}const je=new URL(window.location.href).hostname,l=xe(je),He=Ue(l);Pe({propertyConfig:l,...He}),(M=l==null?void 0:l._clientOptions)!=null&&M.privacyManagerId&&((L=l==null?void 0:l._clientOptions)!=null&&L.manageCookiesLinkOverride)&&Me(l)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/consent-parsers/gpp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/consent-parsers/gpp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAsFtE,wBAAsB,eAAe,gCA4BpC"}
|