@financial-times/cmp-client 6.19.0 → 6.20.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
@@ -881,6 +881,40 @@ async function saveConsent(consentEndpoint, payload) {
881
881
  if (!response.ok) {
882
882
  console.error("Unable to save consent preferences", response.status);
883
883
  }
884
+ try {
885
+ let ucFirst = function(str) {
886
+ return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
887
+ }, normaliseConsentFlag = function(category, channel) {
888
+ return `${category.toLowerCase()}${ucFirst(channel.toLowerCase())}`;
889
+ }, normaliseStatus = function(status) {
890
+ return status ? "on" : "off";
891
+ };
892
+ const responseBody = await response.json();
893
+ const consents = [];
894
+ for (const [category, categoryConsents] of Object.entries(responseBody)) {
895
+ for (const [channel, consent] of Object.entries(categoryConsents)) {
896
+ consents.push(
897
+ `${normaliseConsentFlag(category, channel)}:${normaliseStatus(consent.status)}`
898
+ );
899
+ }
900
+ }
901
+ const consentString = consents.join(",");
902
+ const expectedConsentCategories = [
903
+ "behaviouraladsOnsite",
904
+ "demographicadsOnsite",
905
+ "programmaticadsOnsite"
906
+ ];
907
+ const missingExpectedCategories = expectedConsentCategories.filter(
908
+ (category) => !consentString.includes(category)
909
+ );
910
+ if (missingExpectedCategories.length) {
911
+ return;
912
+ }
913
+ const expires = /* @__PURE__ */ new Date();
914
+ expires.setMonth(expires.getMonth() + 6);
915
+ document.cookie = `FTConsent=${encodeURIComponent(consentString)} expires=${new Date(expires)}; path=/; domain=.ft.com;`;
916
+ } catch {
917
+ }
884
918
  } catch (error) {
885
919
  console.error("An error occurred while saving consent", error);
886
920
  } finally {
@@ -941,9 +975,6 @@ function consentReadyHandlerFn(props) {
941
975
  const updateConsentStore = shouldUpdateConsentStore(props);
942
976
  const consentEndpoint = getConsentEndpoint(updateConsentStore, props);
943
977
  const payload = getConsentPayload(parsedConsent, updateConsentStore, isUserInitiated, props);
944
- if (updateConsentStore) {
945
- document.cookie = "FTConsent=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.ft.com;";
946
- }
947
978
  await saveConsent(consentEndpoint, payload);
948
979
  if (isUserInitiated) {
949
980
  completeWaitingForUser();
@@ -1121,7 +1152,7 @@ function setupFTConsentCookieAuditStorage() {
1121
1152
  localStorage.setItem("__lastFtc", ftConsentCookieValue);
1122
1153
  });
1123
1154
  }
1124
- const version = "6.19.0";
1155
+ const version = "6.20.1";
1125
1156
  async function initSourcepointCmp(options) {
1126
1157
  const {
1127
1158
  useFTSession = true,
package/dist/index.js CHANGED
@@ -879,6 +879,40 @@ async function saveConsent(consentEndpoint, payload) {
879
879
  if (!response.ok) {
880
880
  console.error("Unable to save consent preferences", response.status);
881
881
  }
882
+ try {
883
+ let ucFirst = function(str) {
884
+ return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
885
+ }, normaliseConsentFlag = function(category, channel) {
886
+ return `${category.toLowerCase()}${ucFirst(channel.toLowerCase())}`;
887
+ }, normaliseStatus = function(status) {
888
+ return status ? "on" : "off";
889
+ };
890
+ const responseBody = await response.json();
891
+ const consents = [];
892
+ for (const [category, categoryConsents] of Object.entries(responseBody)) {
893
+ for (const [channel, consent] of Object.entries(categoryConsents)) {
894
+ consents.push(
895
+ `${normaliseConsentFlag(category, channel)}:${normaliseStatus(consent.status)}`
896
+ );
897
+ }
898
+ }
899
+ const consentString = consents.join(",");
900
+ const expectedConsentCategories = [
901
+ "behaviouraladsOnsite",
902
+ "demographicadsOnsite",
903
+ "programmaticadsOnsite"
904
+ ];
905
+ const missingExpectedCategories = expectedConsentCategories.filter(
906
+ (category) => !consentString.includes(category)
907
+ );
908
+ if (missingExpectedCategories.length) {
909
+ return;
910
+ }
911
+ const expires = /* @__PURE__ */ new Date();
912
+ expires.setMonth(expires.getMonth() + 6);
913
+ document.cookie = `FTConsent=${encodeURIComponent(consentString)} expires=${new Date(expires)}; path=/; domain=.ft.com;`;
914
+ } catch {
915
+ }
882
916
  } catch (error) {
883
917
  console.error("An error occurred while saving consent", error);
884
918
  } finally {
@@ -939,9 +973,6 @@ function consentReadyHandlerFn(props) {
939
973
  const updateConsentStore = shouldUpdateConsentStore(props);
940
974
  const consentEndpoint = getConsentEndpoint(updateConsentStore, props);
941
975
  const payload = getConsentPayload(parsedConsent, updateConsentStore, isUserInitiated, props);
942
- if (updateConsentStore) {
943
- document.cookie = "FTConsent=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.ft.com;";
944
- }
945
976
  await saveConsent(consentEndpoint, payload);
946
977
  if (isUserInitiated) {
947
978
  completeWaitingForUser();
@@ -1119,7 +1150,7 @@ function setupFTConsentCookieAuditStorage() {
1119
1150
  localStorage.setItem("__lastFtc", ftConsentCookieValue);
1120
1151
  });
1121
1152
  }
1122
- const version = "6.19.0";
1153
+ const version = "6.20.1";
1123
1154
  async function initSourcepointCmp(options) {
1124
1155
  const {
1125
1156
  useFTSession = true,
@@ -1 +1 @@
1
- (function(){"use strict";const B=(t,{credentials:e="omit"}={})=>fetch(`https://session-next.ft.com${t}`,{credentials:e,useCorsProxy:!0}).then(n=>n.ok?n.json():n.text().then(o=>{throw new Error(`Next session responded with "${o}" (${n.status})`)})).catch(n=>{document.body.dispatchEvent(new CustomEvent("oErrors.log",{bubbles:!0,detail:{error:n,info:{component:"next-session-client"}}}))});let I={};const h=(t,e)=>{if(typeof t=="object"){I=t;return}if(typeof t=="string"&&typeof e=="string"){I[t]=e;return}if(typeof t=="string"&&typeof e>"u")return I[t]||null;if(typeof t>"u"&&typeof e>"u")return I;throw new Error("Invalid arguments")};h.clear=()=>{I={}};const b={},G=()=>{const[,t]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return t},q=()=>{const t=h("uuid");if(t)return Promise.resolve({uuid:t});const e=G();return e?(b.uuid||(b.uuid=B(`/sessions/s/${e}`).then(({uuid:n}={})=>(delete b.uuid,n&&h("uuid",n),{uuid:n}))),b.uuid):Promise.resolve({uuid:void 0})},S="sourcepoint-cmp",W="FTPINK",$="FTConsent",K="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",J=".ft.com",z="https://consent.ft.com",k={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,4,8,9],iabVendors:[],customVendors:[],specialFeatures:[]},personalisedMarketing:{purposes:[2,7,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]},cookies:{purposes:[1,2,3,4,7,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]}},w=Object.keys(k),u={joinHref:!0,gdpr:{}},P={...u,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",includeUsNat:!0}},y={...u,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",includeUsNat:!0}},X={...u,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com",includeUsNat:!0}},Y={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com",includeUsNat:!0}},Q={...u,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com",includeUsNat:!0}},Z={...u,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com",includeUsNat:!0}},tt={...u,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com",includeUsNat:!0}},et={...u,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com",includeUsNat:!0}},nt={...u,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk",includeUsNat:!0}},ot={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},st={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},at={...u,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com",includeUsNat:!0}},ct={...u,accountId:1906,baseEndpoint:"https://consent-manager.ftlocations.com",propertyId:37407,_clientOptions:{rootDomain:"ftlocations.com",cookieDomain:".ftlocations.com",consentProxyHost:"https://consent.ftlocations.com",includeUsNat:!0}},it={...u,accountId:1906,baseEndpoint:"https://consent-manager.financialadviserserviceawards.com",propertyId:38297,_clientOptions:{rootDomain:"financialadviserserviceawards.com",includeUsNat:!0}},rt={...u,accountId:1906,baseEndpoint:"https://consent-manager.celebrationofinvestment.co.uk",propertyId:38296,_clientOptions:{rootDomain:"celebrationofinvestment.co.uk",includeUsNat:!0}},pt={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalprivatebankingawards.com",propertyId:38295,_clientOptions:{rootDomain:"globalprivatebankingawards.com",includeUsNat:!0}},ut={...u,accountId:1906,baseEndpoint:"https://consent-manager.thenextweb.com",propertyId:37672,_clientOptions:{rootDomain:"thenextweb.com"}},dt={...u,accountId:1906,baseEndpoint:"https://consent-manager.invisso.org",propertyId:38851,_clientOptions:{rootDomain:"invisso.org",includeUsNat:!0}},lt={...u,accountId:1906,baseEndpoint:"https://consent-manager.abseast.com",propertyId:38888,_clientOptions:{rootDomain:"abseast.com",includeUsNat:!0}},mt={...u,accountId:1906,baseEndpoint:"https://consent-manager.absasia.org",propertyId:38887,_clientOptions:{rootDomain:"absasia.org",includeUsNat:!0}},ft={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalcoveredbonds.com",propertyId:38886,_clientOptions:{rootDomain:"globalcoveredbonds.com",includeUsNat:!0}},_t={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalborrowers.com",propertyId:38885,_clientOptions:{rootDomain:"globalborrowers.com",includeUsNat:!0}},gt={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalabs.org",propertyId:38884,_clientOptions:{rootDomain:"globalabs.org",includeUsNat:!0}},It={...u,accountId:1906,baseEndpoint:"https://consent-manager.creditrisk-transfer.com",propertyId:38883,_clientOptions:{rootDomain:"creditrisk-transfer.com",includeUsNat:!0}},yt={...u,accountId:1906,baseEndpoint:"https://consent-manager.significantrisktransfer.com",propertyId:38882,_clientOptions:{rootDomain:"significantrisktransfer.com",includeUsNat:!0}},bt={...u,accountId:1906,baseEndpoint:"https://consent-manager.theceeforum.com",propertyId:38881,_clientOptions:{rootDomain:"theceeforum.com",includeUsNat:!0}},wt={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdimarkets.com",propertyId:40508,_clientOptions:{rootDomain:"fdimarkets.com",cookieDomain:".fdimarkets.com",consentProxyHost:"https://consent.fdimarkets.com",includeUsNat:!0}},vt={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdibenchmark.com",propertyId:40509,_clientOptions:{rootDomain:"fdibenchmark.com",cookieDomain:".fdibenchmark.com",consentProxyHost:"https://consent.fdibenchmark.com",includeUsNat:!0}},ht=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:y,FT_DOTCOM_TEST:P,INVISSO:dt,INV_ABSASIA:mt,INV_ABSEAST:lt,INV_CEE_FORUM:bt,INV_CREDITRISK_TRANSFER:It,INV_GLOBAL_ABS:gt,INV_GLOBAL_BORROWERS:_t,INV_GLOBAL_COVERED_BONDS:ft,MM_IGNITES_ASIA:ot,MM_IGNITES_EUROPE:st,SIGRISK_TRANSFER:yt,SP_BANKING_RR:Z,SP_CELEBRATION_OF_INVESTMENT:rt,SP_FDI_BENCHMARK:vt,SP_FDI_INTELLIGENCE:Y,SP_FDI_MARKETS:wt,SP_FTA_SERVICE_AWARDS:it,SP_FT_ADVISER:et,SP_FT_LOCATIONS:ct,SP_GLOBAL_PRIVATE_BANKING_AWARDS:pt,SP_INVESTORS_CHRONICLE:nt,SP_MANDATE_WIRE:at,SP_PWMNET:X,SP_SUSTAINABLE_VIEWS:tt,SP_THE_BANKER:Q,TNW:ut},Symbol.toStringTag,{value:"Module"}));function T(t,e){const n=document.createElement("script");return n.dataset.cmpScript=t,n.innerHTML=e,n}function St(t){const e=document.createElement("script");return e.src=t,e}const Ct={cmpFrames:"https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"};function Ot(){const t=document.createDocumentFragment();return t.appendChild(St(Ct.cmpFrames)),t}function Et(t,e){const{userId:n,includeUsNat:o}=e;return n&&(t.authId=n),o&&(t.usnat=t.usnat||{}),t}function Nt(t,e){const{_clientOptions:n,...o}=t,s=Et(o,e);window._sp_={config:s},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(Ot())}function kt(t){const e={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",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:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],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:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],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:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],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"));'},n=document.createDocumentFragment();n.appendChild(T("tcf",e.tcfStub)),t.includeUsNat&&n.appendChild(T("gpp",e.gppStub)),document.head.appendChild(n)}function Pt(t,e,n,{formOfWordsId:o,cookieDomain:s}){const c=Object.keys(t).reduce((r,i)=>(r[i]={onsite:{status:t[i],lbi:!1,source:S,fow:o}},i==="cookies"&&(r.cookies.userAccept={status:t[i],lbi:!1,source:S,fow:o}),r),{});return e?{setConsentCookie:!0,formOfWordsId:o,consentSource:S,cookieDomain:s,skipDuplicateUpdates:!n,data:c}:{data:c,cookieDomain:s}}const g={CALIFORNIA:"usca",US_NATIONAL:"usnat"},A={[g.CALIFORNIA]:{excludedCategories:{}},[g.US_NATIONAL]:{excludedCategories:{personalisedMarketing:!0}}};function Tt(t){const{applicableSections:e,supportedAPIs:n}=t,o=e[0];if(o===-1||typeof o>"u")return;const s=n.find(c=>c.startsWith(`${o}:`));return s==null?void 0:s.split(":")[1]}function At(t){const{SaleOptOut:e,SharingOptOut:n,Gpc:o}=t,{excludedCategories:s}=A[g.CALIFORNIA],a=e!==1&&n!==1&&!o,c={};for(const r of w){if(r in s){c[r]=!0;continue}c[r]=a}return c}function Dt(t){const{SaleOptOut:e,SharingOptOut:n,TargetedAdvertisingOptOut:o}=t,{excludedCategories:s}=A[g.US_NATIONAL],a=JSON.parse(localStorage.getItem("ft_sp_marketing_optout")||"{}"),c=e!==1&&n!==1&&o!==1,r={};for(const i of w){if(i in s){r[i]=!0;continue}r[i]=c}if(a.usnat)for(const i of w)r[i]=!1;return r}const Mt={[g.CALIFORNIA]:At,[g.US_NATIONAL]:Dt};async function D(){return new Promise((t,e)=>{try{window.__gpp?window.__gpp("ping",t):e(new Error("GPP API is not available on page"))}catch(n){e(n)}})}async function Ut(){const t=await D(),{parsedSections:e}=t,n=Tt(t);if(!n||!e[n])throw new Error("GPP parser was called without an applicable section");const o=e[n],s=Mt[n];if(!s||typeof s!="function")throw new Error(`No parser found for applicable GPP section: ${n}`);return s(o)}function Lt(t,{purpose:e,vendor:n,specialFeatureOptins:o={}}){const s=k[t],a=(e==null?void 0:e.consents)||{},c=(e==null?void 0:e.legitimateInterests)||{},r=(n==null?void 0:n.consents)||{},i=(n==null?void 0:n.legitimateInterests)||{},p=s.purposes.every(l=>a[l]||c[l]),_=s.iabVendors.every(l=>r[l]||i[l]),d=s.specialFeatures.every(l=>o[l]===!0),m=s.purposes.every(l=>a[l]===!0);return t==="cookies"?m&&_&&d:p&&_&&d}async function M(){return new Promise((t,e)=>{try{window.__tcfapi?window.__tcfapi("addEventListener",2,t):e(new Error("TCF API is not available on page"))}catch(n){e(n)}})}async function Ft(){const t=await M(),e={};for(const n of w)e[n]=Lt(n,t);return e}async function Rt(t){const n={gdpr:Ft,usnat:Ut}[t];if(!n)throw new Error("Unable to update user consent. Unsupported consent legislation.");return n()}function U(){const e=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[$];if(!e)return{};const n=decodeURIComponent(e);return Object.fromEntries(n.split(",").map(o=>{const[s,a]=o.split(":");return[s,a==="on"]}))}function Vt(t,e){return Object.keys(t).some(o=>{const s=`${o.toLowerCase()}Onsite`;return t[o]!==e[s]})}function xt({userId:t,useConsentStore:e}){return!!t&&e===!0}function jt(t,e){return t?`${e.consentProxyHost}/__consent/consent-record/${W}/${e.userId}?updateFtConsentCookie=true`:`${e.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${e.cookieDomain}`}const L={gdpr:!1,usnat:!1},C=Object.assign({},L);function F(t){C[t]=!0}function Ht(t){return C[t]}function Bt(){Object.assign(C,L)}async function Gt(t){return Ht(t)?t==="gdpr"?(await M()).eventStatus==="useractioncomplete":t==="usnat"?(await D()).cmpDisplayStatus==="hidden":!1:!1}function qt(){window.__tcfapi&&window.__tcfapi("addEventListener",2,t=>{t.eventStatus==="cmpuishown"&&F("gdpr")}),window.__gpp&&window.__gpp("addEventListener",({pingData:t})=>{t.cmpDisplayStatus==="visible"&&F("usnat")})}function Wt(t={}){const e=new CustomEvent("ft.clientMetric",{bubbles:!0,cancelable:!0,detail:t});document.body.dispatchEvent(e)}async function $t(t,e){try{const n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"include"});n.ok||console.error("Unable to save consent preferences",n.status)}catch(n){console.error("An error occurred while saving consent",n)}finally{document.dispatchEvent(new CustomEvent("onCmpConsentSaveCompleted",{bubbles:!0}))}}const Kt=()=>{document.dispatchEvent(new CustomEvent("onCmpConsentReady",{bubbles:!0}))};function Jt(t){return async function(n,o,s,a){var x,j;if(Kt(),a.applies&&!window._FTConsentReady_&&(window._FTConsentReady_=n),t.disableFTCookies||!t.includeUsNat&&n==="usnat"||!a.applies||!s)return;let c;try{c=await Rt(n)}catch(H){console.error(H)}if(!c||!Vt(c,U()))return;window.dataLayer=(window==null?void 0:window.dataLayer)||[],window.dataLayer.push({event:"consentUpdate",consentUpdateBehaviouralAds:c.behaviouralAds,consentUpdateCookies:c.cookies});const i=t==null?void 0:t.userId,p=(j=(x=window._sp_)==null?void 0:x.config)==null?void 0:j.propertyId;Object.keys(U()).length&&i&&p&&Wt({namespace:"cmp.consentchange",userId:i,propertyId:p,legislation:n});const d=await Gt(n),m=xt(t),l=jt(m,t),ye=Pt(c,m,d,t);m&&(document.cookie="FTConsent=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.ft.com;"),await $t(l,ye),d&&Bt(),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const O="cookie-message",zt="manage-cookies";let E=Object.freeze({activeComponent:O,messageId:0,privacyManagerId:0});function Xt(t){return typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]"}const Yt=()=>({...E}),N=t=>{if(!Xt(t)){console.error("Invalid state changes");return}E={...E,...t}},Qt=["adsDisableInternalCMP","pwm.cmp"];function Zt(t,e){const n=te(t.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[a,c]of Object.entries(ne))(s=(o=window._sp_).addEventListener)==null||s.call(o,a,c({...t,flags:n}))}),oe({...t,flags:n},e),se()}function te(t){const e={};return typeof t=="object"&&Qt.forEach(n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}),e}function ee(t){if(!t)return;const e=document.body,n=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:t.detail});e.dispatchEvent(n)}function v({trackingProps:t,action:e,triggerAction:n}){let o;const s=Yt(),{product:a,app:c,flags:r}=t;s.activeComponent===O?o=s.messageId:o=s.privacyManagerId;const i={detail:{component:{id:o,name:s.activeComponent,type:"overlay",subtype:"cmp"},category:"component",action:e,...n&&{trigger_action:n},...a&&{product:a},...c&&{app:c},custom:[{cookie_toggle_flag:r}],url:window.document.location.href||null}};ee(i)}const ne={onMessageChoiceSelect:t=>(e,n,o)=>{const a={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];a&&v({trackingProps:t,action:"click",triggerAction:a})},onMessageReady:t=>()=>{v({trackingProps:t,action:"view"})},onMessageReceiveData:()=>(t,e)=>{const{messageId:n}=e;n&&N({messageId:n})},onError:t=>(e,n)=>{v({trackingProps:t,action:"error",triggerAction:n})},onPMCancel:()=>()=>{N({activeComponent:O})}};function oe(t,e){window.addEventListener("message",function(n){if(n.origin!==e)return;const o={1:"save_and_close",11:"accept_all",13:"reject_all"},{data:{fromPM:s,actionType:a,messageId:c="0"}={}}=n;s&&(+c&&N({activeComponent:zt,privacyManagerId:+c}),!(!a||!o[a])&&v({trackingProps:t,action:"click",triggerAction:o[a]}))},!1)}function se(){document.addEventListener("onCmpConsentSaveCompleted",()=>{const t=document.cookie.match(/FTConsent=([^;]+)/);if(!t)return;const e=t[1];localStorage.setItem("__lastFtc",e)})}const ae="6.19.0";async function ce(t){const{useFTSession:e=!0,consentProxyHost:n=z,cookieDomain:o=J,formOfWordsId:s=K,useConsentStore:a=!0,trackingContext:c={},disableFTCookies:r=!1,includeUsNat:i=!1}=t||{};let{propertyConfig:p=y,userId:_}=t||{};if(typeof window>"u"){console.error("The CMP client can only be initialised in a browser context");return}if(window.FT_CMP_CLIENT_VERSION=ae,kt({includeUsNat:i}),!_&&e)try{const d=await q();_=d==null?void 0:d.uuid}catch(d){console.error(d)}p=ie(p),Nt(p,{userId:_,includeUsNat:i}),qt(),window._sp_queue.push(()=>{var d,m;(m=(d=window._sp_)==null?void 0:d.addEventListener)==null||m.call(d,"onConsentReady",Jt({userId:_,consentProxyHost:n,cookieDomain:o,formOfWordsId:s,useConsentStore:a,disableFTCookies:r,includeUsNat:i}))}),Zt(c,p.baseEndpoint)}function ie(t){if(!(t!=null&&t.accountId))throw new Error("Please pass a valid property config");return t.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 t.events),t}function R(t,e,n,o,s,a){const{text:c,onClick:r}=o[e],i=document.querySelectorAll(`a[href*="${a}"]`);for(const p of i)(n||t)&&(s.has(p)&&p.removeEventListener("click",s.get(p)),p.innerText=c,p.addEventListener("click",r),s.set(p,r))}function re({_clientOptions:t}=y){const{privacyManagerId:e,ccpaPrivacyManagerId:n,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=t??y._clientOptions,a={usnat:{text:"Do Not Sell My Personal Information",onClick:i=>{var p;i.preventDefault(),(p=window._sp_.usnat)==null||p.loadPrivacyManagerModal(o)}},ccpa:{text:"Do Not Sell My Personal Information",onClick:i=>{var p;i.preventDefault(),(p=window._sp_.ccpa)==null||p.loadPrivacyManagerModal(n)}},gdpr:{text:"Manage Cookies",onClick:i=>{var p;i.preventDefault(),(p=window._sp_.gdpr)==null||p.loadPrivacyManagerModal(e)}}},c=new Map,r=function(i,p,_,d){R(!1,i,d.applies,a,c,s),d.applies&&window._sp_queue.push(()=>{var m,l;(l=(m=window._sp_).removeEventListener)==null||l.call(m,"onConsentReady",r)})};R(!0,"gdpr",!1,a,c,s),window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var i,p;(p=(i=window._sp_).addEventListener)==null||p.call(i,"onConsentReady",r)})}function pe(t=window,e){var c,r;const n="_cmp_open_pm_";if(!t._sp_)return;const{privacyManagerId:o,usnatPrivacyManagerId:s}=e??y._clientOptions,a=new URLSearchParams(t.location.search);if(a.has(n))switch(a.get(n)||""){case"usnat":(c=t._sp_.usnat)==null||c.loadPrivacyManagerModal(s);break;case"gdpr":(r=t._sp_.gdpr)==null||r.loadPrivacyManagerModal(o);break}}function ue(t){window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var e,n;(n=(e=window._sp_)==null?void 0:e.addEventListener)==null||n.call(e,"onSPReady",()=>pe(window,t))})}function de(t){return t._clientOptions??{}}const le={"ft.com":de};function me(t){return new Promise((e,n)=>{const{rootDomain:o}=t._clientOptions||{};if(!o)return e({});const s=le[o];if(!s||typeof s!="function")return e({...t._clientOptions});const a=()=>{try{e(s(t))}catch(c){n(c)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()})}const fe={...{joinHref:!0,gdpr:{}},accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyId:41863,propertyHref:"https://globalbondsummit.live.ft.com",_clientOptions:{subDomain:"globalbondsummit.live.ft.com",includeUsNat:!0}},_e=Object.freeze(Object.defineProperty({__proto__:null,INV_GLOBAL_BONDS_SUMMIT:fe},Symbol.toStringTag,{value:"Module"}));function V(t,e){if(!e||Number.isFinite(parseFloat(e)))return!1;const n=t===e,o=t.endsWith(`.${e}`);return n||o}function ge(t){if(!t)throw new Error("Invalid hostname provided");const e=Object.values(ht),o=Object.values(_e).find(a=>{var r;const c=(r=a==null?void 0:a._clientOptions)==null?void 0:r.subDomain;return c&&V(t,c)});if(o)return o;let s=e.find(a=>{var r;if(a.propertyHref)return!1;const c=(r=a._clientOptions)==null?void 0:r.rootDomain;return c&&V(t,c)});return s??(s=P),s}const Ie=new URL(window.location.href).hostname,f=ge(Ie);(async()=>{var t,e;try{const n=await me(f);ce({propertyConfig:f,...n}),(t=f==null?void 0:f._clientOptions)!=null&&t.privacyManagerId&&((e=f==null?void 0:f._clientOptions)!=null&&e.manageCookiesLinkOverride)&&(re(f),ue(f._clientOptions))}catch(n){console.error("Error: CMP package configure + initialise Sourcepoint failed.",n)}})()})();
1
+ (function(){"use strict";const B=(t,{credentials:e="omit"}={})=>fetch(`https://session-next.ft.com${t}`,{credentials:e,useCorsProxy:!0}).then(n=>n.ok?n.json():n.text().then(o=>{throw new Error(`Next session responded with "${o}" (${n.status})`)})).catch(n=>{document.body.dispatchEvent(new CustomEvent("oErrors.log",{bubbles:!0,detail:{error:n,info:{component:"next-session-client"}}}))});let y={};const C=(t,e)=>{if(typeof t=="object"){y=t;return}if(typeof t=="string"&&typeof e=="string"){y[t]=e;return}if(typeof t=="string"&&typeof e>"u")return y[t]||null;if(typeof t>"u"&&typeof e>"u")return y;throw new Error("Invalid arguments")};C.clear=()=>{y={}};const b={},G=()=>{const[,t]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return t},q=()=>{const t=C("uuid");if(t)return Promise.resolve({uuid:t});const e=G();return e?(b.uuid||(b.uuid=B(`/sessions/s/${e}`).then(({uuid:n}={})=>(delete b.uuid,n&&C("uuid",n),{uuid:n}))),b.uuid):Promise.resolve({uuid:void 0})},S="sourcepoint-cmp",W="FTPINK",K="FTConsent",J="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",z=".ft.com",X="https://consent.ft.com",T={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,4,8,9],iabVendors:[],customVendors:[],specialFeatures:[]},personalisedMarketing:{purposes:[2,7,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]},cookies:{purposes:[1,2,3,4,7,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]}},w=Object.keys(T),u={joinHref:!0,gdpr:{}},A={...u,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",includeUsNat:!0}},I={...u,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",includeUsNat:!0}},Y={...u,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com",includeUsNat:!0}},Q={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com",includeUsNat:!0}},Z={...u,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com",includeUsNat:!0}},tt={...u,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com",includeUsNat:!0}},et={...u,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com",includeUsNat:!0}},nt={...u,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com",includeUsNat:!0}},ot={...u,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk",includeUsNat:!0}},st={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},at={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},ct={...u,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com",includeUsNat:!0}},it={...u,accountId:1906,baseEndpoint:"https://consent-manager.ftlocations.com",propertyId:37407,_clientOptions:{rootDomain:"ftlocations.com",cookieDomain:".ftlocations.com",consentProxyHost:"https://consent.ftlocations.com",includeUsNat:!0}},rt={...u,accountId:1906,baseEndpoint:"https://consent-manager.financialadviserserviceawards.com",propertyId:38297,_clientOptions:{rootDomain:"financialadviserserviceawards.com",includeUsNat:!0}},pt={...u,accountId:1906,baseEndpoint:"https://consent-manager.celebrationofinvestment.co.uk",propertyId:38296,_clientOptions:{rootDomain:"celebrationofinvestment.co.uk",includeUsNat:!0}},ut={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalprivatebankingawards.com",propertyId:38295,_clientOptions:{rootDomain:"globalprivatebankingawards.com",includeUsNat:!0}},dt={...u,accountId:1906,baseEndpoint:"https://consent-manager.thenextweb.com",propertyId:37672,_clientOptions:{rootDomain:"thenextweb.com"}},lt={...u,accountId:1906,baseEndpoint:"https://consent-manager.invisso.org",propertyId:38851,_clientOptions:{rootDomain:"invisso.org",includeUsNat:!0}},mt={...u,accountId:1906,baseEndpoint:"https://consent-manager.abseast.com",propertyId:38888,_clientOptions:{rootDomain:"abseast.com",includeUsNat:!0}},ft={...u,accountId:1906,baseEndpoint:"https://consent-manager.absasia.org",propertyId:38887,_clientOptions:{rootDomain:"absasia.org",includeUsNat:!0}},gt={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalcoveredbonds.com",propertyId:38886,_clientOptions:{rootDomain:"globalcoveredbonds.com",includeUsNat:!0}},_t={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalborrowers.com",propertyId:38885,_clientOptions:{rootDomain:"globalborrowers.com",includeUsNat:!0}},yt={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalabs.org",propertyId:38884,_clientOptions:{rootDomain:"globalabs.org",includeUsNat:!0}},It={...u,accountId:1906,baseEndpoint:"https://consent-manager.creditrisk-transfer.com",propertyId:38883,_clientOptions:{rootDomain:"creditrisk-transfer.com",includeUsNat:!0}},bt={...u,accountId:1906,baseEndpoint:"https://consent-manager.significantrisktransfer.com",propertyId:38882,_clientOptions:{rootDomain:"significantrisktransfer.com",includeUsNat:!0}},wt={...u,accountId:1906,baseEndpoint:"https://consent-manager.theceeforum.com",propertyId:38881,_clientOptions:{rootDomain:"theceeforum.com",includeUsNat:!0}},ht={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdimarkets.com",propertyId:40508,_clientOptions:{rootDomain:"fdimarkets.com",cookieDomain:".fdimarkets.com",consentProxyHost:"https://consent.fdimarkets.com",includeUsNat:!0}},vt={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdibenchmark.com",propertyId:40509,_clientOptions:{rootDomain:"fdibenchmark.com",cookieDomain:".fdibenchmark.com",consentProxyHost:"https://consent.fdibenchmark.com",includeUsNat:!0}},Ct=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:I,FT_DOTCOM_TEST:A,INVISSO:lt,INV_ABSASIA:ft,INV_ABSEAST:mt,INV_CEE_FORUM:wt,INV_CREDITRISK_TRANSFER:It,INV_GLOBAL_ABS:yt,INV_GLOBAL_BORROWERS:_t,INV_GLOBAL_COVERED_BONDS:gt,MM_IGNITES_ASIA:st,MM_IGNITES_EUROPE:at,SIGRISK_TRANSFER:bt,SP_BANKING_RR:tt,SP_CELEBRATION_OF_INVESTMENT:pt,SP_FDI_BENCHMARK:vt,SP_FDI_INTELLIGENCE:Q,SP_FDI_MARKETS:ht,SP_FTA_SERVICE_AWARDS:rt,SP_FT_ADVISER:nt,SP_FT_LOCATIONS:it,SP_GLOBAL_PRIVATE_BANKING_AWARDS:ut,SP_INVESTORS_CHRONICLE:ot,SP_MANDATE_WIRE:ct,SP_PWMNET:Y,SP_SUSTAINABLE_VIEWS:et,SP_THE_BANKER:Z,TNW:dt},Symbol.toStringTag,{value:"Module"}));function D(t,e){const n=document.createElement("script");return n.dataset.cmpScript=t,n.innerHTML=e,n}function St(t){const e=document.createElement("script");return e.src=t,e}const Ot={cmpFrames:"https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"};function Et(){const t=document.createDocumentFragment();return t.appendChild(St(Ot.cmpFrames)),t}function Nt(t,e){const{userId:n,includeUsNat:o}=e;return n&&(t.authId=n),o&&(t.usnat=t.usnat||{}),t}function kt(t,e){const{_clientOptions:n,...o}=t,s=Nt(o,e);window._sp_={config:s},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(Et())}function Pt(t){const e={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",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:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],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:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],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:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],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"));'},n=document.createDocumentFragment();n.appendChild(D("tcf",e.tcfStub)),t.includeUsNat&&n.appendChild(D("gpp",e.gppStub)),document.head.appendChild(n)}function Tt(t,e,n,{formOfWordsId:o,cookieDomain:s}){const c=Object.keys(t).reduce((r,i)=>(r[i]={onsite:{status:t[i],lbi:!1,source:S,fow:o}},i==="cookies"&&(r.cookies.userAccept={status:t[i],lbi:!1,source:S,fow:o}),r),{});return e?{setConsentCookie:!0,formOfWordsId:o,consentSource:S,cookieDomain:s,skipDuplicateUpdates:!n,data:c}:{data:c,cookieDomain:s}}const _={CALIFORNIA:"usca",US_NATIONAL:"usnat"},M={[_.CALIFORNIA]:{excludedCategories:{}},[_.US_NATIONAL]:{excludedCategories:{personalisedMarketing:!0}}};function At(t){const{applicableSections:e,supportedAPIs:n}=t,o=e[0];if(o===-1||typeof o>"u")return;const s=n.find(c=>c.startsWith(`${o}:`));return s==null?void 0:s.split(":")[1]}function Dt(t){const{SaleOptOut:e,SharingOptOut:n,Gpc:o}=t,{excludedCategories:s}=M[_.CALIFORNIA],a=e!==1&&n!==1&&!o,c={};for(const r of w){if(r in s){c[r]=!0;continue}c[r]=a}return c}function Mt(t){const{SaleOptOut:e,SharingOptOut:n,TargetedAdvertisingOptOut:o}=t,{excludedCategories:s}=M[_.US_NATIONAL],a=JSON.parse(localStorage.getItem("ft_sp_marketing_optout")||"{}"),c=e!==1&&n!==1&&o!==1,r={};for(const i of w){if(i in s){r[i]=!0;continue}r[i]=c}if(a.usnat)for(const i of w)r[i]=!1;return r}const Ut={[_.CALIFORNIA]:Dt,[_.US_NATIONAL]:Mt};async function U(){return new Promise((t,e)=>{try{window.__gpp?window.__gpp("ping",t):e(new Error("GPP API is not available on page"))}catch(n){e(n)}})}async function Lt(){const t=await U(),{parsedSections:e}=t,n=At(t);if(!n||!e[n])throw new Error("GPP parser was called without an applicable section");const o=e[n],s=Ut[n];if(!s||typeof s!="function")throw new Error(`No parser found for applicable GPP section: ${n}`);return s(o)}function Ft(t,{purpose:e,vendor:n,specialFeatureOptins:o={}}){const s=T[t],a=(e==null?void 0:e.consents)||{},c=(e==null?void 0:e.legitimateInterests)||{},r=(n==null?void 0:n.consents)||{},i=(n==null?void 0:n.legitimateInterests)||{},p=s.purposes.every(m=>a[m]||c[m]),g=s.iabVendors.every(m=>r[m]||i[m]),d=s.specialFeatures.every(m=>o[m]===!0),l=s.purposes.every(m=>a[m]===!0);return t==="cookies"?l&&g&&d:p&&g&&d}async function L(){return new Promise((t,e)=>{try{window.__tcfapi?window.__tcfapi("addEventListener",2,t):e(new Error("TCF API is not available on page"))}catch(n){e(n)}})}async function Rt(){const t=await L(),e={};for(const n of w)e[n]=Ft(n,t);return e}async function Vt(t){const n={gdpr:Rt,usnat:Lt}[t];if(!n)throw new Error("Unable to update user consent. Unsupported consent legislation.");return n()}function F(){const e=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[K];if(!e)return{};const n=decodeURIComponent(e);return Object.fromEntries(n.split(",").map(o=>{const[s,a]=o.split(":");return[s,a==="on"]}))}function xt(t,e){return Object.keys(t).some(o=>{const s=`${o.toLowerCase()}Onsite`;return t[o]!==e[s]})}function jt({userId:t,useConsentStore:e}){return!!t&&e===!0}function Ht(t,e){return t?`${e.consentProxyHost}/__consent/consent-record/${W}/${e.userId}?updateFtConsentCookie=true`:`${e.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${e.cookieDomain}`}const R={gdpr:!1,usnat:!1},O=Object.assign({},R);function V(t){O[t]=!0}function $t(t){return O[t]}function Bt(){Object.assign(O,R)}async function Gt(t){return $t(t)?t==="gdpr"?(await L()).eventStatus==="useractioncomplete":t==="usnat"?(await U()).cmpDisplayStatus==="hidden":!1:!1}function qt(){window.__tcfapi&&window.__tcfapi("addEventListener",2,t=>{t.eventStatus==="cmpuishown"&&V("gdpr")}),window.__gpp&&window.__gpp("addEventListener",({pingData:t})=>{t.cmpDisplayStatus==="visible"&&V("usnat")})}function Wt(t={}){const e=new CustomEvent("ft.clientMetric",{bubbles:!0,cancelable:!0,detail:t});document.body.dispatchEvent(e)}async function Kt(t,e){try{const n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"include"});n.ok||console.error("Unable to save consent preferences",n.status);try{let o=function(l){return`${l.charAt(0).toUpperCase()}${l.slice(1)}`},s=function(l,m){return`${l.toLowerCase()}${o(m.toLowerCase())}`},a=function(l){return l?"on":"off"};const c=await n.json(),r=[];for(const[l,m]of Object.entries(c))for(const[P,v]of Object.entries(m))r.push(`${s(l,P)}:${a(v.status)}`);const i=r.join(",");if(["behaviouraladsOnsite","demographicadsOnsite","programmaticadsOnsite"].filter(l=>!i.includes(l)).length)return;const d=new Date;d.setMonth(d.getMonth()+6),document.cookie=`FTConsent=${encodeURIComponent(i)} expires=${new Date(d)}; path=/; domain=.ft.com;`}catch{}}catch(n){console.error("An error occurred while saving consent",n)}finally{document.dispatchEvent(new CustomEvent("onCmpConsentSaveCompleted",{bubbles:!0}))}}const Jt=()=>{document.dispatchEvent(new CustomEvent("onCmpConsentReady",{bubbles:!0}))};function zt(t){return async function(n,o,s,a){var v,H;if(Jt(),a.applies&&!window._FTConsentReady_&&(window._FTConsentReady_=n),t.disableFTCookies||!t.includeUsNat&&n==="usnat"||!a.applies||!s)return;let c;try{c=await Vt(n)}catch($){console.error($)}if(!c||!xt(c,F()))return;window.dataLayer=(window==null?void 0:window.dataLayer)||[],window.dataLayer.push({event:"consentUpdate",consentUpdateBehaviouralAds:c.behaviouralAds,consentUpdateCookies:c.cookies});const i=t==null?void 0:t.userId,p=(H=(v=window._sp_)==null?void 0:v.config)==null?void 0:H.propertyId;Object.keys(F()).length&&i&&p&&Wt({namespace:"cmp.consentchange",userId:i,propertyId:p,legislation:n});const d=await Gt(n),l=jt(t),m=Ht(l,t),P=Tt(c,l,d,t);await Kt(m,P),d&&Bt(),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const E="cookie-message",Xt="manage-cookies";let N=Object.freeze({activeComponent:E,messageId:0,privacyManagerId:0});function Yt(t){return typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]"}const Qt=()=>({...N}),k=t=>{if(!Yt(t)){console.error("Invalid state changes");return}N={...N,...t}},Zt=["adsDisableInternalCMP","pwm.cmp"];function te(t,e){const n=ee(t.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[a,c]of Object.entries(oe))(s=(o=window._sp_).addEventListener)==null||s.call(o,a,c({...t,flags:n}))}),se({...t,flags:n},e),ae()}function ee(t){const e={};return typeof t=="object"&&Zt.forEach(n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}),e}function ne(t){if(!t)return;const e=document.body,n=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:t.detail});e.dispatchEvent(n)}function h({trackingProps:t,action:e,triggerAction:n}){let o;const s=Qt(),{product:a,app:c,flags:r}=t;s.activeComponent===E?o=s.messageId:o=s.privacyManagerId;const i={detail:{component:{id:o,name:s.activeComponent,type:"overlay",subtype:"cmp"},category:"component",action:e,...n&&{trigger_action:n},...a&&{product:a},...c&&{app:c},custom:[{cookie_toggle_flag:r}],url:window.document.location.href||null}};ne(i)}const oe={onMessageChoiceSelect:t=>(e,n,o)=>{const a={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];a&&h({trackingProps:t,action:"click",triggerAction:a})},onMessageReady:t=>()=>{h({trackingProps:t,action:"view"})},onMessageReceiveData:()=>(t,e)=>{const{messageId:n}=e;n&&k({messageId:n})},onError:t=>(e,n)=>{h({trackingProps:t,action:"error",triggerAction:n})},onPMCancel:()=>()=>{k({activeComponent:E})}};function se(t,e){window.addEventListener("message",function(n){if(n.origin!==e)return;const o={1:"save_and_close",11:"accept_all",13:"reject_all"},{data:{fromPM:s,actionType:a,messageId:c="0"}={}}=n;s&&(+c&&k({activeComponent:Xt,privacyManagerId:+c}),!(!a||!o[a])&&h({trackingProps:t,action:"click",triggerAction:o[a]}))},!1)}function ae(){document.addEventListener("onCmpConsentSaveCompleted",()=>{const t=document.cookie.match(/FTConsent=([^;]+)/);if(!t)return;const e=t[1];localStorage.setItem("__lastFtc",e)})}const ce="6.20.1";async function ie(t){const{useFTSession:e=!0,consentProxyHost:n=X,cookieDomain:o=z,formOfWordsId:s=J,useConsentStore:a=!0,trackingContext:c={},disableFTCookies:r=!1,includeUsNat:i=!1}=t||{};let{propertyConfig:p=I,userId:g}=t||{};if(typeof window>"u"){console.error("The CMP client can only be initialised in a browser context");return}if(window.FT_CMP_CLIENT_VERSION=ce,Pt({includeUsNat:i}),!g&&e)try{const d=await q();g=d==null?void 0:d.uuid}catch(d){console.error(d)}p=re(p),kt(p,{userId:g,includeUsNat:i}),qt(),window._sp_queue.push(()=>{var d,l;(l=(d=window._sp_)==null?void 0:d.addEventListener)==null||l.call(d,"onConsentReady",zt({userId:g,consentProxyHost:n,cookieDomain:o,formOfWordsId:s,useConsentStore:a,disableFTCookies:r,includeUsNat:i}))}),te(c,p.baseEndpoint)}function re(t){if(!(t!=null&&t.accountId))throw new Error("Please pass a valid property config");return t.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 t.events),t}function x(t,e,n,o,s,a){const{text:c,onClick:r}=o[e],i=document.querySelectorAll(`a[href*="${a}"]`);for(const p of i)(n||t)&&(s.has(p)&&p.removeEventListener("click",s.get(p)),p.innerText=c,p.addEventListener("click",r),s.set(p,r))}function pe({_clientOptions:t}=I){const{privacyManagerId:e,ccpaPrivacyManagerId:n,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=t??I._clientOptions,a={usnat:{text:"Do Not Sell My Personal Information",onClick:i=>{var p;i.preventDefault(),(p=window._sp_.usnat)==null||p.loadPrivacyManagerModal(o)}},ccpa:{text:"Do Not Sell My Personal Information",onClick:i=>{var p;i.preventDefault(),(p=window._sp_.ccpa)==null||p.loadPrivacyManagerModal(n)}},gdpr:{text:"Manage Cookies",onClick:i=>{var p;i.preventDefault(),(p=window._sp_.gdpr)==null||p.loadPrivacyManagerModal(e)}}},c=new Map,r=function(i,p,g,d){x(!1,i,d.applies,a,c,s),d.applies&&window._sp_queue.push(()=>{var l,m;(m=(l=window._sp_).removeEventListener)==null||m.call(l,"onConsentReady",r)})};x(!0,"gdpr",!1,a,c,s),window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var i,p;(p=(i=window._sp_).addEventListener)==null||p.call(i,"onConsentReady",r)})}function ue(t=window,e){var c,r;const n="_cmp_open_pm_";if(!t._sp_)return;const{privacyManagerId:o,usnatPrivacyManagerId:s}=e??I._clientOptions,a=new URLSearchParams(t.location.search);if(a.has(n))switch(a.get(n)||""){case"usnat":(c=t._sp_.usnat)==null||c.loadPrivacyManagerModal(s);break;case"gdpr":(r=t._sp_.gdpr)==null||r.loadPrivacyManagerModal(o);break}}function de(t){window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var e,n;(n=(e=window._sp_)==null?void 0:e.addEventListener)==null||n.call(e,"onSPReady",()=>ue(window,t))})}function le(t){return t._clientOptions??{}}const me={"ft.com":le};function fe(t){return new Promise((e,n)=>{const{rootDomain:o}=t._clientOptions||{};if(!o)return e({});const s=me[o];if(!s||typeof s!="function")return e({...t._clientOptions});const a=()=>{try{e(s(t))}catch(c){n(c)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()})}const ge={...{joinHref:!0,gdpr:{}},accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyId:41863,propertyHref:"https://globalbondsummit.live.ft.com",_clientOptions:{subDomain:"globalbondsummit.live.ft.com",includeUsNat:!0}},_e=Object.freeze(Object.defineProperty({__proto__:null,INV_GLOBAL_BONDS_SUMMIT:ge},Symbol.toStringTag,{value:"Module"}));function j(t,e){if(!e||Number.isFinite(parseFloat(e)))return!1;const n=t===e,o=t.endsWith(`.${e}`);return n||o}function ye(t){if(!t)throw new Error("Invalid hostname provided");const e=Object.values(Ct),o=Object.values(_e).find(a=>{var r;const c=(r=a==null?void 0:a._clientOptions)==null?void 0:r.subDomain;return c&&j(t,c)});if(o)return o;let s=e.find(a=>{var r;if(a.propertyHref)return!1;const c=(r=a._clientOptions)==null?void 0:r.rootDomain;return c&&j(t,c)});return s??(s=A),s}const Ie=new URL(window.location.href).hostname,f=ye(Ie);(async()=>{var t,e;try{const n=await fe(f);ie({propertyConfig:f,...n}),(t=f==null?void 0:f._clientOptions)!=null&&t.privacyManagerId&&((e=f==null?void 0:f._clientOptions)!=null&&e.manageCookiesLinkOverride)&&(pe(f),de(f._clientOptions))}catch(n){console.error("Error: CMP package configure + initialise Sourcepoint failed.",n)}})()})();
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/consent-ready/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAc/E,wBAAsB,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,iBAwB1F;AAMD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,iBAE7C,WAAW,gBACV,MAAM,iBACL,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mBAmGrC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/consent-ready/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAc/E,wBAAsB,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,iBAwG1F;AAMD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,iBAE7C,WAAW,gBACV,MAAM,iBACL,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mBAuFrC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/cmp-client",
3
- "version": "6.19.0",
3
+ "version": "6.20.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [