@financial-times/cmp-client 5.2.0-beta.1 → 5.2.1-beta.1
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
|
@@ -435,10 +435,14 @@ const sections = {
|
|
|
435
435
|
};
|
|
436
436
|
const sectionConfig = {
|
|
437
437
|
[sections.CALIFORNIA]: {
|
|
438
|
-
excludedCategories: {
|
|
438
|
+
excludedCategories: {
|
|
439
|
+
personalisedMarketing: true
|
|
440
|
+
}
|
|
439
441
|
},
|
|
440
442
|
[sections.US_NATIONAL]: {
|
|
441
|
-
excludedCategories: {
|
|
443
|
+
excludedCategories: {
|
|
444
|
+
personalisedMarketing: true
|
|
445
|
+
}
|
|
442
446
|
}
|
|
443
447
|
};
|
|
444
448
|
function getApplicableSection(gppData) {
|
|
@@ -468,6 +472,7 @@ function parseCaliforniaSection(sectionData) {
|
|
|
468
472
|
function parseUsNationalSection(sectionData) {
|
|
469
473
|
const { SaleOptOut, SharingOptOut, TargetedAdvertisingOptOut } = sectionData;
|
|
470
474
|
const { excludedCategories } = sectionConfig[sections.US_NATIONAL];
|
|
475
|
+
const marketingOptOutStatus = JSON.parse(localStorage.getItem("ft_sp_marketing_optout") || "{}");
|
|
471
476
|
const userHasNotOptedOut = SaleOptOut !== 1 && SharingOptOut !== 1 && TargetedAdvertisingOptOut !== 1;
|
|
472
477
|
const parsedConsent = {};
|
|
473
478
|
for (const categoryName of iabCategoryNames) {
|
|
@@ -477,6 +482,10 @@ function parseUsNationalSection(sectionData) {
|
|
|
477
482
|
}
|
|
478
483
|
parsedConsent[categoryName] = userHasNotOptedOut;
|
|
479
484
|
}
|
|
485
|
+
if (marketingOptOutStatus.usnat) {
|
|
486
|
+
parsedConsent.personalisedMarketing = false;
|
|
487
|
+
parsedConsent.behaviouralAds = false;
|
|
488
|
+
}
|
|
480
489
|
return parsedConsent;
|
|
481
490
|
}
|
|
482
491
|
const sectionParsers = {
|
|
@@ -794,7 +803,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
794
803
|
false
|
|
795
804
|
);
|
|
796
805
|
}
|
|
797
|
-
const version = "5.2.
|
|
806
|
+
const version = "5.2.1-beta.1";
|
|
798
807
|
async function initSourcepointCmp(options) {
|
|
799
808
|
const {
|
|
800
809
|
useFTSession = true,
|
package/dist/index.js
CHANGED
|
@@ -433,10 +433,14 @@ const sections = {
|
|
|
433
433
|
};
|
|
434
434
|
const sectionConfig = {
|
|
435
435
|
[sections.CALIFORNIA]: {
|
|
436
|
-
excludedCategories: {
|
|
436
|
+
excludedCategories: {
|
|
437
|
+
personalisedMarketing: true
|
|
438
|
+
}
|
|
437
439
|
},
|
|
438
440
|
[sections.US_NATIONAL]: {
|
|
439
|
-
excludedCategories: {
|
|
441
|
+
excludedCategories: {
|
|
442
|
+
personalisedMarketing: true
|
|
443
|
+
}
|
|
440
444
|
}
|
|
441
445
|
};
|
|
442
446
|
function getApplicableSection(gppData) {
|
|
@@ -466,6 +470,7 @@ function parseCaliforniaSection(sectionData) {
|
|
|
466
470
|
function parseUsNationalSection(sectionData) {
|
|
467
471
|
const { SaleOptOut, SharingOptOut, TargetedAdvertisingOptOut } = sectionData;
|
|
468
472
|
const { excludedCategories } = sectionConfig[sections.US_NATIONAL];
|
|
473
|
+
const marketingOptOutStatus = JSON.parse(localStorage.getItem("ft_sp_marketing_optout") || "{}");
|
|
469
474
|
const userHasNotOptedOut = SaleOptOut !== 1 && SharingOptOut !== 1 && TargetedAdvertisingOptOut !== 1;
|
|
470
475
|
const parsedConsent = {};
|
|
471
476
|
for (const categoryName of iabCategoryNames) {
|
|
@@ -475,6 +480,10 @@ function parseUsNationalSection(sectionData) {
|
|
|
475
480
|
}
|
|
476
481
|
parsedConsent[categoryName] = userHasNotOptedOut;
|
|
477
482
|
}
|
|
483
|
+
if (marketingOptOutStatus.usnat) {
|
|
484
|
+
parsedConsent.personalisedMarketing = false;
|
|
485
|
+
parsedConsent.behaviouralAds = false;
|
|
486
|
+
}
|
|
478
487
|
return parsedConsent;
|
|
479
488
|
}
|
|
480
489
|
const sectionParsers = {
|
|
@@ -792,7 +801,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
792
801
|
false
|
|
793
802
|
);
|
|
794
803
|
}
|
|
795
|
-
const version = "5.2.
|
|
804
|
+
const version = "5.2.1-beta.1";
|
|
796
805
|
async function initSourcepointCmp(options) {
|
|
797
806
|
const {
|
|
798
807
|
useFTSession = true,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";
|
|
2
|
-
`};function
|
|
1
|
+
(function(){"use strict";const L=(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 y={},D=()=>{const[,e]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return e},R=()=>{const e=I("uuid");if(e)return Promise.resolve({uuid:e});const n=D();return n?(y.uuid||(y.uuid=L(`/sessions/s/${n}`).then(({uuid:t}={})=>(delete y.uuid,t&&I("uuid",t),{uuid:t}))),y.uuid):Promise.resolve({uuid:void 0})},O="sourcepoint-cmp",F="FTPINK",U="FTConsent",V="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",x=".ft.com",j="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"}},v={...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"}},H={...d,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com"}},q={...d,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com"}},G={...d,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com"}},$={...d,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com"}},W={...d,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com"}},J={...d,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com"}},K={...d,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk"}},B={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},X={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},Y={...d,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com"}},z=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:v,FT_DOTCOM_TEST:k,MM_IGNITES_ASIA:B,MM_IGNITES_EUROPE:X,SP_BANKING_RR:$,SP_FDI_INTELLIGENCE:q,SP_FT_ADVISER:J,SP_INVESTORS_CHRONICLE:K,SP_MANDATE_WIRE:Y,SP_PWMNET:H,SP_SUSTAINABLE_VIEWS:W,SP_THE_BANKER:G},Symbol.toStringTag,{value:"Module"}));function T(e,n){const t=document.createElement("script");return t.dataset.cmpScript=e,t.innerHTML=n,t}function Z(e){const n=document.createElement("script");return n.src=e,n}const Q={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 ee(e){const n=document.createDocumentFragment();return n.appendChild(T("tcf",N.tcfStub)),e.includeUsNat&&n.appendChild(T("gpp",N.gppStub)),n.appendChild(Z(Q.cmpFrames)),n}function te(e,n){const{userId:t,includeUsNat:o}=n;return t&&(e.authId=t),o&&(e.usnat=e.usnat||{}),e}function ne(e,n){const{_clientOptions:t,...o}=e,s=te(o,n);window._sp_={config:s},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(ee(n))}function oe(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 se(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 re(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 ae(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 ie={[m.CALIFORNIA]:re,[m.US_NATIONAL]:ae};async function ce(){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=se(e);if(!t||!n[t])throw new Error("GPP parser was called without an applicable section");const o=n[t],s=ie[t];if(!s||typeof s!="function")throw new Error(`No parser found for applicable GPP section: ${t}`);return s(o)}function pe(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 ue(){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]=pe(t,e);return n}async function de(e){const t={gdpr:ue,usnat:ce}[e];if(!t)throw new Error("Unable to update user consent. Unsupported consent legislation.");return t()}function le(){const n=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[U];if(!n)return{};const t=decodeURIComponent(n);return Object.fromEntries(t.split(",").map(o=>{const[s,r]=o.split(":");return[s,r==="on"]}))}function fe(e,n){return Object.keys(e).some(o=>{const s=`${o.toLowerCase()}Onsite`;return e[o]!==n[s]})}function ge({userId:e,useConsentStore:n}){return!!e&&n===!0}function me(e,n){return e?`${n.consentProxyHost}/__consent/consent-record/${F}/${n.userId}`:`${n.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${n.cookieDomain}`}async function _e(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 ye(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 de(a)}catch(g){console.error(g)}if(!i||!fe(i,le()))return;const p=ge(e),f=me(p,e),u=oe(i,p,e);await _e(f,u),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const b="cookie-message",ve="manage-cookies";let h=Object.freeze({activeComponent:b,messageId:0,privacyManagerId:0});function we(e){return typeof e=="object"&&e!==null&&e.constructor===Object&&Object.prototype.toString.call(e)==="[object Object]"}const Ie=()=>({...h}),S=e=>{if(!we(e)){console.error("Invalid state changes");return}h={...h,...e}},Ce=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function be(e,n){const t=he(e.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[r,a]of Object.entries(Oe))(s=(o=window._sp_).addEventListener)==null||s.call(o,r,a({...e,flags:t}))}),Ee({...e,flags:t},n)}function he(e){const n={};return typeof e=="object"&&Ce.forEach(t=>{Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}),n}function Se(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=Ie(),{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}};Se(c)}const Oe={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 Ee(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:ve,privacyManagerId:+a}),!(!r||!o[r])&&w({trackingProps:e,action:"click",triggerAction:o[r]}))},!1)}const ke="5.2.1-beta.1";async function Te(e){const{useFTSession:n=!0,consentProxyHost:t=j,cookieDomain:o=x,formOfWordsId:s=V,useConsentStore:r=!0,trackingContext:a={},disableFTCookies:i=!1,includeUsNat:c=!1}=e||{};let{propertyConfig:p=v,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=ke,!f&&n)try{const u=await R();f=u==null?void 0:u.uuid}catch(u){console.error(u)}p=Ne(p),ne(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",ye({userId:f,consentProxyHost:t,cookieDomain:o,formOfWordsId:s,useConsentStore:r,disableFTCookies:i,includeUsNat:c}))}),be(a,p.baseEndpoint)}function Ne(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 Pe({_clientOptions:e}=v){const{privacyManagerId:n,ccpaPrivacyManagerId:t,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=e??v._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,M;(M=(g=window._sp_).removeEventListener)==null||M.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 Ae(e){const n=document.querySelector(e);return n?JSON.parse(n.textContent||"{}"):{}}function Me(){return{flags:Ae("script#page-kit-flags-embed")}}function Le(e){const{includeUsNat:n}=e._clientOptions||{},{flags:t}=Me();return t!=null&&t.adsEnableGpp||n?{includeUsNat:!0}:{}}const De={"ft.com":Le};function Re(e){return new Promise((n,t)=>{const{rootDomain:o}=e._clientOptions||{};if(!o){n({});return}const s=De[o];if(!s||typeof s!="function"){n({});return}document.addEventListener("DOMContentLoaded",()=>{try{n(s(e))}catch(r){t(r)}})})}function Fe(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 Ue(e){if(!e)throw new Error("Invalid hostname provided");let t=Object.values(z).find(o=>{var r;if(o.propertyHref)return!1;const s=(r=o._clientOptions)==null?void 0:r.rootDomain;return s&&Fe(e,s)});return t??(t=k),t}const Ve=new URL(window.location.href).hostname,l=Ue(Ve);(async()=>{var e,n;try{const t=await Re(l);console.log(t),Te({propertyConfig:l,...t}),(e=l==null?void 0:l._clientOptions)!=null&&e.privacyManagerId&&((n=l==null?void 0:l._clientOptions)!=null&&n.manageCookiesLinkOverride)&&Pe(l)}catch(t){console.error("Error:",t)}})()})();
|
|
@@ -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"}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
1
|
import { SPConfig } from "../../../typings/types";
|
|
2
|
-
export declare function getRuntimeOptions(activeProperty: SPConfig):
|
|
3
|
-
propertyConfig: SPConfig;
|
|
4
|
-
userId: string;
|
|
5
|
-
useFTSession: boolean;
|
|
6
|
-
consentProxyHost: string;
|
|
7
|
-
cookieDomain: string;
|
|
8
|
-
formOfWordsId: string;
|
|
9
|
-
useConsentStore: boolean;
|
|
10
|
-
trackingContext: import("../../../typings/types").TrackingContext;
|
|
11
|
-
disableFTCookies: boolean;
|
|
12
|
-
includeUsNat: boolean;
|
|
13
|
-
}>;
|
|
2
|
+
export declare function getRuntimeOptions(activeProperty: SPConfig): Promise<SPConfig>;
|
|
14
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/configurators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAWlE,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,QAAQ
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/configurators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAWlE,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuB7E"}
|