@financial-times/cmp-client 5.10.0 → 6.0.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/README.md +11 -0
- package/dist/index.cjs +27 -12
- package/dist/index.js +27 -12
- package/dist/scripts/cmp-static.js +2 -2
- package/dist/src/html/cmp-manage-cookies-link.d.ts +1 -5
- package/dist/src/html/cmp-manage-cookies-link.d.ts.map +1 -1
- package/dist/src/lib/constants.d.ts +2 -1
- package/dist/src/lib/constants.d.ts.map +1 -1
- package/dist/src/lib/properties.d.ts +20 -0
- package/dist/src/lib/properties.d.ts.map +1 -1
- package/dist/src/tracking/state.d.ts.map +1 -1
- package/dist/src/utils/url.d.ts +18 -0
- package/dist/src/utils/url.d.ts.map +1 -1
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -19,6 +19,12 @@ Install as a \<script> tag (**recommended**):
|
|
|
19
19
|
<script async src="https://consent-notice.ft.com/cmp.js"></script>
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
To enable development branch previews (recommended), set the script referrer policy as follows:
|
|
23
|
+
|
|
24
|
+
```copy
|
|
25
|
+
<script async src="https://consent-notice.ft.com/cmp.js" referrerpolicy="no-referrer-when-downgrade"></script>
|
|
26
|
+
```
|
|
27
|
+
|
|
22
28
|
Install the library from NPM:
|
|
23
29
|
|
|
24
30
|
```copy
|
|
@@ -276,6 +282,11 @@ Visit https://localhost:5173 (see setup details in `src/examples/cmp-client`) to
|
|
|
276
282
|
|
|
277
283
|
> For resetting your consent cookies/record and other common troubleshooting issues, see the [Troubleshooting Guide](./docs/troubleshooting.md)
|
|
278
284
|
|
|
285
|
+
### Branch previews
|
|
286
|
+
|
|
287
|
+
You can also preview changes on your branch in a consuming app that uses the static loader script and is configured as described above. Append a `cmp_preview` query param as follows with its value set to the first seven digits of the branch's commit hash. This can easily be obtained in a Git-based VCS UI or using `git rev-parse --short HEAD`. And then appended as:
|
|
288
|
+
`https://ft.com?cmp_preview=<SHORT_COMMIT_SHA>`
|
|
289
|
+
|
|
279
290
|
#### Resources
|
|
280
291
|
|
|
281
292
|
For a detailed deep-dive (internal only) of how the static deployment process works, the design is [documented here](https://financialtimes.atlassian.net/wiki/spaces/ADS/pages/8293711881/How+the+CMP+static+loader+works). If you need to be granted access, please reach out to the Ads & Privacy team.
|
package/dist/index.cjs
CHANGED
|
@@ -202,10 +202,29 @@ const SP_GLOBAL_PRIVATE_BANKING_AWARDS = {
|
|
|
202
202
|
rootDomain: "globalprivatebankingawards.com"
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
|
+
const TNW = {
|
|
206
|
+
...defaults,
|
|
207
|
+
accountId: 1906,
|
|
208
|
+
baseEndpoint: "https://consent-manager.thenextweb.com",
|
|
209
|
+
propertyId: 37672,
|
|
210
|
+
_clientOptions: {
|
|
211
|
+
rootDomain: "thenextweb.com"
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const INVISSO = {
|
|
215
|
+
...defaults,
|
|
216
|
+
accountId: 1906,
|
|
217
|
+
baseEndpoint: "https://consent-manager.invisso.org",
|
|
218
|
+
propertyId: 38851,
|
|
219
|
+
_clientOptions: {
|
|
220
|
+
rootDomain: "invisso.org"
|
|
221
|
+
}
|
|
222
|
+
};
|
|
205
223
|
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
206
224
|
__proto__: null,
|
|
207
225
|
FT_DOTCOM_PROD,
|
|
208
226
|
FT_DOTCOM_TEST,
|
|
227
|
+
INVISSO,
|
|
209
228
|
MM_IGNITES_ASIA,
|
|
210
229
|
MM_IGNITES_EUROPE,
|
|
211
230
|
SP_BANKING_RR,
|
|
@@ -219,7 +238,8 @@ const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
219
238
|
SP_MANDATE_WIRE,
|
|
220
239
|
SP_PWMNET,
|
|
221
240
|
SP_SUSTAINABLE_VIEWS,
|
|
222
|
-
SP_THE_BANKER
|
|
241
|
+
SP_THE_BANKER,
|
|
242
|
+
TNW
|
|
223
243
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
224
244
|
function findAndUpdateLinks(fallback, regionId, regionApplies, regionConfig, linkMap, manageCookiesLinkOverride) {
|
|
225
245
|
const { text, onClick } = regionConfig[regionId];
|
|
@@ -616,8 +636,7 @@ function getConsentCookieValue() {
|
|
|
616
636
|
document.cookie.split("; ").map((cookie) => cookie.split("="))
|
|
617
637
|
);
|
|
618
638
|
const encodedValue = cookies[CONSENT_COOKIE_NAME];
|
|
619
|
-
if (!encodedValue)
|
|
620
|
-
return {};
|
|
639
|
+
if (!encodedValue) return {};
|
|
621
640
|
const decodedValue = decodeURIComponent(encodedValue);
|
|
622
641
|
return Object.fromEntries(
|
|
623
642
|
decodedValue.split(",").map((consent) => {
|
|
@@ -787,8 +806,7 @@ function extractRelevantFlags(flags) {
|
|
|
787
806
|
return output;
|
|
788
807
|
}
|
|
789
808
|
function track(payload) {
|
|
790
|
-
if (!payload)
|
|
791
|
-
return;
|
|
809
|
+
if (!payload) return;
|
|
792
810
|
const rootEl = document.body;
|
|
793
811
|
const event = new CustomEvent("oTracking.event", {
|
|
794
812
|
bubbles: true,
|
|
@@ -880,24 +898,21 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
880
898
|
window.addEventListener(
|
|
881
899
|
"message",
|
|
882
900
|
function(event) {
|
|
883
|
-
if (event.origin !== cmpBaseEndpoint)
|
|
884
|
-
return;
|
|
901
|
+
if (event.origin !== cmpBaseEndpoint) return;
|
|
885
902
|
const actionTypeMap = {
|
|
886
903
|
1: "save_and_close",
|
|
887
904
|
11: "accept_all",
|
|
888
905
|
13: "reject_all"
|
|
889
906
|
};
|
|
890
907
|
const { data: { fromPM, actionType, messageId = "0" } = {} } = event;
|
|
891
|
-
if (!fromPM)
|
|
892
|
-
return;
|
|
908
|
+
if (!fromPM) return;
|
|
893
909
|
if (+messageId) {
|
|
894
910
|
setState({
|
|
895
911
|
activeComponent: PRIVACY_MANAGER,
|
|
896
912
|
privacyManagerId: +messageId
|
|
897
913
|
});
|
|
898
914
|
}
|
|
899
|
-
if (!actionType || !actionTypeMap[actionType])
|
|
900
|
-
return;
|
|
915
|
+
if (!actionType || !actionTypeMap[actionType]) return;
|
|
901
916
|
dispatchComponentEvent({
|
|
902
917
|
trackingProps,
|
|
903
918
|
action: "click",
|
|
@@ -907,7 +922,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
907
922
|
false
|
|
908
923
|
);
|
|
909
924
|
}
|
|
910
|
-
const version = "
|
|
925
|
+
const version = "6.0.1";
|
|
911
926
|
async function initSourcepointCmp(options) {
|
|
912
927
|
const {
|
|
913
928
|
useFTSession = true,
|
package/dist/index.js
CHANGED
|
@@ -200,10 +200,29 @@ const SP_GLOBAL_PRIVATE_BANKING_AWARDS = {
|
|
|
200
200
|
rootDomain: "globalprivatebankingawards.com"
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
|
+
const TNW = {
|
|
204
|
+
...defaults,
|
|
205
|
+
accountId: 1906,
|
|
206
|
+
baseEndpoint: "https://consent-manager.thenextweb.com",
|
|
207
|
+
propertyId: 37672,
|
|
208
|
+
_clientOptions: {
|
|
209
|
+
rootDomain: "thenextweb.com"
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const INVISSO = {
|
|
213
|
+
...defaults,
|
|
214
|
+
accountId: 1906,
|
|
215
|
+
baseEndpoint: "https://consent-manager.invisso.org",
|
|
216
|
+
propertyId: 38851,
|
|
217
|
+
_clientOptions: {
|
|
218
|
+
rootDomain: "invisso.org"
|
|
219
|
+
}
|
|
220
|
+
};
|
|
203
221
|
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
204
222
|
__proto__: null,
|
|
205
223
|
FT_DOTCOM_PROD,
|
|
206
224
|
FT_DOTCOM_TEST,
|
|
225
|
+
INVISSO,
|
|
207
226
|
MM_IGNITES_ASIA,
|
|
208
227
|
MM_IGNITES_EUROPE,
|
|
209
228
|
SP_BANKING_RR,
|
|
@@ -217,7 +236,8 @@ const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
217
236
|
SP_MANDATE_WIRE,
|
|
218
237
|
SP_PWMNET,
|
|
219
238
|
SP_SUSTAINABLE_VIEWS,
|
|
220
|
-
SP_THE_BANKER
|
|
239
|
+
SP_THE_BANKER,
|
|
240
|
+
TNW
|
|
221
241
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
222
242
|
function findAndUpdateLinks(fallback, regionId, regionApplies, regionConfig, linkMap, manageCookiesLinkOverride) {
|
|
223
243
|
const { text, onClick } = regionConfig[regionId];
|
|
@@ -614,8 +634,7 @@ function getConsentCookieValue() {
|
|
|
614
634
|
document.cookie.split("; ").map((cookie) => cookie.split("="))
|
|
615
635
|
);
|
|
616
636
|
const encodedValue = cookies[CONSENT_COOKIE_NAME];
|
|
617
|
-
if (!encodedValue)
|
|
618
|
-
return {};
|
|
637
|
+
if (!encodedValue) return {};
|
|
619
638
|
const decodedValue = decodeURIComponent(encodedValue);
|
|
620
639
|
return Object.fromEntries(
|
|
621
640
|
decodedValue.split(",").map((consent) => {
|
|
@@ -785,8 +804,7 @@ function extractRelevantFlags(flags) {
|
|
|
785
804
|
return output;
|
|
786
805
|
}
|
|
787
806
|
function track(payload) {
|
|
788
|
-
if (!payload)
|
|
789
|
-
return;
|
|
807
|
+
if (!payload) return;
|
|
790
808
|
const rootEl = document.body;
|
|
791
809
|
const event = new CustomEvent("oTracking.event", {
|
|
792
810
|
bubbles: true,
|
|
@@ -878,24 +896,21 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
878
896
|
window.addEventListener(
|
|
879
897
|
"message",
|
|
880
898
|
function(event) {
|
|
881
|
-
if (event.origin !== cmpBaseEndpoint)
|
|
882
|
-
return;
|
|
899
|
+
if (event.origin !== cmpBaseEndpoint) return;
|
|
883
900
|
const actionTypeMap = {
|
|
884
901
|
1: "save_and_close",
|
|
885
902
|
11: "accept_all",
|
|
886
903
|
13: "reject_all"
|
|
887
904
|
};
|
|
888
905
|
const { data: { fromPM, actionType, messageId = "0" } = {} } = event;
|
|
889
|
-
if (!fromPM)
|
|
890
|
-
return;
|
|
906
|
+
if (!fromPM) return;
|
|
891
907
|
if (+messageId) {
|
|
892
908
|
setState({
|
|
893
909
|
activeComponent: PRIVACY_MANAGER,
|
|
894
910
|
privacyManagerId: +messageId
|
|
895
911
|
});
|
|
896
912
|
}
|
|
897
|
-
if (!actionType || !actionTypeMap[actionType])
|
|
898
|
-
return;
|
|
913
|
+
if (!actionType || !actionTypeMap[actionType]) return;
|
|
899
914
|
dispatchComponentEvent({
|
|
900
915
|
trackingProps,
|
|
901
916
|
action: "click",
|
|
@@ -905,7 +920,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
905
920
|
false
|
|
906
921
|
);
|
|
907
922
|
}
|
|
908
|
-
const version = "
|
|
923
|
+
const version = "6.0.1";
|
|
909
924
|
async function initSourcepointCmp(options) {
|
|
910
925
|
const {
|
|
911
926
|
useFTSession = true,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";const V=(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 _={};const
|
|
2
|
-
`};function pt(t){const e=document.createDocumentFragment();return e.appendChild(N("tcf",A.tcfStub)),t.includeUsNat&&e.appendChild(N("gpp",A.gppStub)),e.appendChild(rt(ct.cmpFrames)),e}function ut(t,e){const{userId:n,includeUsNat:o}=e;return n&&(t.authId=n),o&&(t.usnat=t.usnat||{}),t}function dt(t,e){const{_clientOptions:n,...o}=t,s=ut(o,e);window._sp_={config:s},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(pt(e))}function lt(t,e,n,{formOfWordsId:o,cookieDomain:s}){const r=Object.keys(t).reduce((c,i)=>(c[i]={onsite:{status:t[i],lbi:!1,source:T,fow:o}},c),{});return e?{setConsentCookie:!0,formOfWordsId:o,consentSource:T,cookieDomain:s,skipDuplicateUpdates:!n,data:r}:{data:r,cookieDomain:s}}const m={CALIFORNIA:"uscav1",US_NATIONAL:"usnat"},D={[m.CALIFORNIA]:{excludedCategories:{personalisedMarketing:!0}},[m.US_NATIONAL]:{excludedCategories:{personalisedMarketing:!0}}};function ft(t){const{applicableSections:e,supportedAPIs:n}=t,o=e[0];if(o===-1||typeof o>"u")return;const s=n.find(r=>r.startsWith(`${o}:`));return s==null?void 0:s.split(":")[1]}function gt(t){const{SaleOptOut:e,SharingOptOut:n,Gpc:o}=t,{excludedCategories:s}=D[m.CALIFORNIA],a=e!==1&&n!==1&&!o,r={};for(const c of v){if(c in s){r[c]=!0;continue}r[c]=a}return r}function mt(t){const{SaleOptOut:e,SharingOptOut:n,TargetedAdvertisingOptOut:o}=t,{excludedCategories:s}=D[m.US_NATIONAL],a=JSON.parse(localStorage.getItem("ft_sp_marketing_optout")||"{}"),r=e!==1&&n!==1&&o!==1,c={};for(const i of v){if(i in s){c[i]=!0;continue}c[i]=r}if(a.usnat)for(const i of v)c[i]=!1;return c}const _t={[m.CALIFORNIA]:gt,[m.US_NATIONAL]:mt};async function M(){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 yt(){const t=await M(),{parsedSections:e}=t,n=ft(t);if(!n||!e[n])throw new Error("GPP parser was called without an applicable section");const o=e[n],s=_t[n];if(!s||typeof s!="function")throw new Error(`No parser found for applicable GPP section: ${n}`);return s(o)}function vt(t,{purpose:e,vendor:n,specialFeatureOptins:o}){const s=k[t],a=s.purposes.every(i=>(e==null?void 0:e.consents[i])||(e==null?void 0:e.legitimateInterests[i])),r=s.iabVendors.every(i=>(n==null?void 0:n.consents[i])||(n==null?void 0:n.legitimateInterests[i])),c=s.specialFeatures.every(i=>(o==null?void 0:o[i])===!0);return a&&r&&c}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 wt(){const t=await L(),e={};for(const n of v)e[n]=vt(n,t);return e}async function It(t){const n={gdpr:wt,usnat:yt}[t];if(!n)throw new Error("Unable to update user consent. Unsupported consent legislation.");return n()}function St(){const e=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[q];if(!e)return{};const n=decodeURIComponent(e);return Object.fromEntries(n.split(",").map(o=>{const[s,a]=o.split(":");return[s,a==="on"]}))}function Ct(t,e){return Object.keys(t).some(o=>{const s=`${o.toLowerCase()}Onsite`;return t[o]!==e[s]})}function bt({userId:t,useConsentStore:e}){return!!t&&e===!0}function ht(t,e){return t?`${e.consentProxyHost}/__consent/consent-record/${H}/${e.userId}?updateFtConsentCookie=true`:`${e.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${e.cookieDomain}`}const F={gdpr:!1,usnat:!1},b=Object.assign({},F);function R(t){b[t]=!0}function Ot(t){return b[t]}function Et(){Object.assign(b,F)}async function Tt(t){return Ot(t)?t==="gdpr"?(await L()).eventStatus==="useractioncomplete":t==="usnat"?(await M()).cmpDisplayStatus==="hidden":!1:!1}function kt(){window.__tcfapi&&window.__tcfapi("addEventListener",2,t=>{t.eventStatus==="cmpuishown"&&R("gdpr")}),window.__gpp&&window.__gpp("addEventListener",({pingData:t})=>{t.cmpDisplayStatus==="visible"&&R("usnat")})}async function Pt(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)}}const Nt=()=>{document.dispatchEvent(new CustomEvent("onCmpConsentReady",{bubbles:!0}))};function At(t){return async function(n,o,s,a){if(Nt(),t.disableFTCookies||!t.includeUsNat&&n==="usnat")return;const r=a.applies?n:"gdpr";if(r!==n||!s)return;let c;try{c=await It(r)}catch(S){console.error(S)}if(!c||!Ct(c,St()))return;const p=await Tt(r),f=bt(t),d=ht(f,t),g=lt(c,f,p,t);await Pt(d,g),p&&Et(),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const h="cookie-message",Dt="manage-cookies";let O=Object.freeze({activeComponent:h,messageId:0,privacyManagerId:0});function Mt(t){return typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]"}const Lt=()=>({...O}),E=t=>{if(!Mt(t)){console.error("Invalid state changes");return}O={...O,...t}},Ft=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function Rt(t,e){const n=Ut(t.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[a,r]of Object.entries(xt))(s=(o=window._sp_).addEventListener)==null||s.call(o,a,r({...t,flags:n}))}),jt({...t,flags:n},e)}function Ut(t){const e={};return typeof t=="object"&&Ft.forEach(n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}),e}function Vt(t){if(!t)return;const e=document.body,n=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:t.detail});e.dispatchEvent(n)}function I({trackingProps:t,action:e,triggerAction:n}){let o;const s=Lt(),{product:a,app:r,flags:c}=t;s.activeComponent===h?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},...r&&{app:r},custom:[{cookie_toggle_flag:c}],url:window.document.location.href||null}};Vt(i)}const xt={onMessageChoiceSelect:t=>(e,n,o)=>{const a={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];a&&I({trackingProps:t,action:"click",triggerAction:a})},onMessageReady:t=>()=>{I({trackingProps:t,action:"view"})},onMessageReceiveData:()=>(t,e)=>{const{messageId:n}=e;n&&E({messageId:n})},onError:t=>(e,n)=>{I({trackingProps:t,action:"error",triggerAction:n})},onPMCancel:()=>()=>{E({activeComponent:h})}};function jt(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:r="0"}={}}=n;s&&(+r&&E({activeComponent:Dt,privacyManagerId:+r}),!(!a||!o[a])&&I({trackingProps:t,action:"click",triggerAction:o[a]}))},!1)}const Ht="5.10.0";async function qt(t){const{useFTSession:e=!0,consentProxyHost:n=$,cookieDomain:o=W,formOfWordsId:s=G,useConsentStore:a=!0,trackingContext:r={},disableFTCookies:c=!1,includeUsNat:i=!1}=t||{};let{propertyConfig:p=w,userId:f}=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=Ht,!f&&e)try{const d=await j();f=d==null?void 0:d.uuid}catch(d){console.error(d)}p=Gt(p),dt(p,{userId:f,includeUsNat:i}),kt(),window._sp_queue.push(()=>{var d,g;(g=(d=window._sp_)==null?void 0:d.addEventListener)==null||g.call(d,"onConsentReady",At({userId:f,consentProxyHost:n,cookieDomain:o,formOfWordsId:s,useConsentStore:a,disableFTCookies:c,includeUsNat:i}))}),Rt(r,p.baseEndpoint)}function Gt(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 U(t,e,n,o,s,a){const{text:r,onClick:c}=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=r,p.addEventListener("click",c),s.set(p,c))}function Wt({_clientOptions:t}=w){const{privacyManagerId:e,ccpaPrivacyManagerId:n,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=t??w._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)}}},r=new Map,c=function(i,p,f,d){U(!1,i,d.applies,a,r,s),d.applies&&window._sp_queue.push(()=>{var g,S;(S=(g=window._sp_).removeEventListener)==null||S.call(g,"onConsentReady",c)})};U(!0,"gdpr",!1,a,r,s),window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var i,p;(p=(i=window._sp_).addEventListener)==null||p.call(i,"onConsentReady",c)})}function $t(t){return t._clientOptions??{}}const Kt={"ft.com":$t};function Bt(t){return new Promise((e,n)=>{const{rootDomain:o}=t._clientOptions||{};if(!o)return e({});const s=Kt[o];if(!s||typeof s!="function")return e({...t._clientOptions});const a=()=>{try{e(s(t))}catch(r){n(r)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()})}function Jt(t,e){if(!e||Number.isFinite(parseFloat(e))||!t.endsWith(e))return!1;const n=t.indexOf(e),o=t[n-1];return o==="."||o===void 0}function Xt(t){if(!t)throw new Error("Invalid hostname provided");let n=Object.values(it).find(o=>{var a;if(o.propertyHref)return!1;const s=(a=o._clientOptions)==null?void 0:a.rootDomain;return s&&Jt(t,s)});return n??(n=P),n}const Yt=new URL(window.location.href).hostname,l=Xt(Yt);(async()=>{var t,e;try{const n=await Bt(l);qt({propertyConfig:l,...n}),(t=l==null?void 0:l._clientOptions)!=null&&t.privacyManagerId&&((e=l==null?void 0:l._clientOptions)!=null&&e.manageCookiesLinkOverride)&&Wt(l)}catch(n){console.error("Error: CMP package configure + initialise Sourcepoint failed.",n)}})()})();
|
|
1
|
+
(function(){"use strict";const V=(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 _={};const S=(t,e)=>{if(typeof t=="object"){_=t;return}if(typeof t=="string"&&typeof e=="string"){_[t]=e;return}if(typeof t=="string"&&typeof e>"u")return _[t]||null;if(typeof t>"u"&&typeof e>"u")return _;throw new Error("Invalid arguments")};S.clear=()=>{_={}};const y={},x=()=>{const[,t]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return t},j=()=>{const t=S("uuid");if(t)return Promise.resolve({uuid:t});const e=x();return e?(y.uuid||(y.uuid=V(`/sessions/s/${e}`).then(({uuid:n}={})=>(delete y.uuid,n&&S("uuid",n),{uuid:n}))),y.uuid):Promise.resolve({uuid:void 0})},T="sourcepoint-cmp",H="FTPINK",q="FTConsent",G="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",W=".ft.com",$="https://consent.ft.com",N={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:[]}},v=Object.keys(N),u={joinHref:!0,gdpr:{}},k={...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}},w={...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}},K={...u,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com"}},B={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com"}},J={...u,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com"}},X={...u,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com"}},Y={...u,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com"}},z={...u,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com"}},Z={...u,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk"}},Q={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},tt={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},et={...u,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com"}},nt={...u,accountId:1906,baseEndpoint:"https://consent-manager.ftlocations.com",propertyId:37407,_clientOptions:{rootDomain:"ftlocations.com",cookieDomain:".ftlocations.com",consentProxyHost:"https://consent.ftlocations.com"}},ot={...u,accountId:1906,baseEndpoint:"https://consent-manager.financialadviserserviceawards.com",propertyId:38297,_clientOptions:{rootDomain:"financialadviserserviceawards.com"}},st={...u,accountId:1906,baseEndpoint:"https://consent-manager.celebrationofinvestment.co.uk",propertyId:38296,_clientOptions:{rootDomain:"celebrationofinvestment.co.uk"}},at={...u,accountId:1906,baseEndpoint:"https://consent-manager.globalprivatebankingawards.com",propertyId:38295,_clientOptions:{rootDomain:"globalprivatebankingawards.com"}},it={...u,accountId:1906,baseEndpoint:"https://consent-manager.thenextweb.com",propertyId:37672,_clientOptions:{rootDomain:"thenextweb.com"}},rt={...u,accountId:1906,baseEndpoint:"https://consent-manager.invisso.org",propertyId:38851,_clientOptions:{rootDomain:"invisso.org"}},ct=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:w,FT_DOTCOM_TEST:k,INVISSO:rt,MM_IGNITES_ASIA:Q,MM_IGNITES_EUROPE:tt,SP_BANKING_RR:X,SP_CELEBRATION_OF_INVESTMENT:st,SP_FDI_INTELLIGENCE:B,SP_FTA_SERVICE_AWARDS:ot,SP_FT_ADVISER:z,SP_FT_LOCATIONS:nt,SP_GLOBAL_PRIVATE_BANKING_AWARDS:at,SP_INVESTORS_CHRONICLE:Z,SP_MANDATE_WIRE:et,SP_PWMNET:K,SP_SUSTAINABLE_VIEWS:Y,SP_THE_BANKER:J,TNW:it},Symbol.toStringTag,{value:"Module"}));function P(t,e){const n=document.createElement("script");return n.dataset.cmpScript=t,n.innerHTML=e,n}function pt(t){const e=document.createElement("script");return e.src=t,e}const ut={cmpFrames:"https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"},A={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:usnat","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:usnat","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:usnat","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 dt(t){const e=document.createDocumentFragment();return e.appendChild(P("tcf",A.tcfStub)),t.includeUsNat&&e.appendChild(P("gpp",A.gppStub)),e.appendChild(pt(ut.cmpFrames)),e}function lt(t,e){const{userId:n,includeUsNat:o}=e;return n&&(t.authId=n),o&&(t.usnat=t.usnat||{}),t}function ft(t,e){const{_clientOptions:n,...o}=t,s=lt(o,e);window._sp_={config:s},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(dt(e))}function gt(t,e,n,{formOfWordsId:o,cookieDomain:s}){const r=Object.keys(t).reduce((c,i)=>(c[i]={onsite:{status:t[i],lbi:!1,source:T,fow:o}},c),{});return e?{setConsentCookie:!0,formOfWordsId:o,consentSource:T,cookieDomain:s,skipDuplicateUpdates:!n,data:r}:{data:r,cookieDomain:s}}const m={CALIFORNIA:"uscav1",US_NATIONAL:"usnat"},D={[m.CALIFORNIA]:{excludedCategories:{personalisedMarketing:!0}},[m.US_NATIONAL]:{excludedCategories:{personalisedMarketing:!0}}};function mt(t){const{applicableSections:e,supportedAPIs:n}=t,o=e[0];if(o===-1||typeof o>"u")return;const s=n.find(r=>r.startsWith(`${o}:`));return s==null?void 0:s.split(":")[1]}function _t(t){const{SaleOptOut:e,SharingOptOut:n,Gpc:o}=t,{excludedCategories:s}=D[m.CALIFORNIA],a=e!==1&&n!==1&&!o,r={};for(const c of v){if(c in s){r[c]=!0;continue}r[c]=a}return r}function yt(t){const{SaleOptOut:e,SharingOptOut:n,TargetedAdvertisingOptOut:o}=t,{excludedCategories:s}=D[m.US_NATIONAL],a=JSON.parse(localStorage.getItem("ft_sp_marketing_optout")||"{}"),r=e!==1&&n!==1&&o!==1,c={};for(const i of v){if(i in s){c[i]=!0;continue}c[i]=r}if(a.usnat)for(const i of v)c[i]=!1;return c}const vt={[m.CALIFORNIA]:_t,[m.US_NATIONAL]:yt};async function M(){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 wt(){const t=await M(),{parsedSections:e}=t,n=mt(t);if(!n||!e[n])throw new Error("GPP parser was called without an applicable section");const o=e[n],s=vt[n];if(!s||typeof s!="function")throw new Error(`No parser found for applicable GPP section: ${n}`);return s(o)}function It(t,{purpose:e,vendor:n,specialFeatureOptins:o}){const s=N[t],a=s.purposes.every(i=>(e==null?void 0:e.consents[i])||(e==null?void 0:e.legitimateInterests[i])),r=s.iabVendors.every(i=>(n==null?void 0:n.consents[i])||(n==null?void 0:n.legitimateInterests[i])),c=s.specialFeatures.every(i=>(o==null?void 0:o[i])===!0);return a&&r&&c}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 bt(){const t=await L(),e={};for(const n of v)e[n]=It(n,t);return e}async function St(t){const n={gdpr:bt,usnat:wt}[t];if(!n)throw new Error("Unable to update user consent. Unsupported consent legislation.");return n()}function Ct(){const e=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[q];if(!e)return{};const n=decodeURIComponent(e);return Object.fromEntries(n.split(",").map(o=>{const[s,a]=o.split(":");return[s,a==="on"]}))}function ht(t,e){return Object.keys(t).some(o=>{const s=`${o.toLowerCase()}Onsite`;return t[o]!==e[s]})}function Ot({userId:t,useConsentStore:e}){return!!t&&e===!0}function Et(t,e){return t?`${e.consentProxyHost}/__consent/consent-record/${H}/${e.userId}?updateFtConsentCookie=true`:`${e.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${e.cookieDomain}`}const F={gdpr:!1,usnat:!1},C=Object.assign({},F);function R(t){C[t]=!0}function Tt(t){return C[t]}function Nt(){Object.assign(C,F)}async function kt(t){return Tt(t)?t==="gdpr"?(await L()).eventStatus==="useractioncomplete":t==="usnat"?(await M()).cmpDisplayStatus==="hidden":!1:!1}function Pt(){window.__tcfapi&&window.__tcfapi("addEventListener",2,t=>{t.eventStatus==="cmpuishown"&&R("gdpr")}),window.__gpp&&window.__gpp("addEventListener",({pingData:t})=>{t.cmpDisplayStatus==="visible"&&R("usnat")})}async function At(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)}}const Dt=()=>{document.dispatchEvent(new CustomEvent("onCmpConsentReady",{bubbles:!0}))};function Mt(t){return async function(n,o,s,a){if(Dt(),t.disableFTCookies||!t.includeUsNat&&n==="usnat")return;const r=a.applies?n:"gdpr";if(r!==n||!s)return;let c;try{c=await St(r)}catch(b){console.error(b)}if(!c||!ht(c,Ct()))return;const p=await kt(r),f=Ot(t),d=Et(f,t),g=gt(c,f,p,t);await At(d,g),p&&Nt(),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const h="cookie-message",Lt="manage-cookies";let O=Object.freeze({activeComponent:h,messageId:0,privacyManagerId:0});function Ft(t){return typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]"}const Rt=()=>({...O}),E=t=>{if(!Ft(t)){console.error("Invalid state changes");return}O={...O,...t}},Ut=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function Vt(t,e){const n=xt(t.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[a,r]of Object.entries(Ht))(s=(o=window._sp_).addEventListener)==null||s.call(o,a,r({...t,flags:n}))}),qt({...t,flags:n},e)}function xt(t){const e={};return typeof t=="object"&&Ut.forEach(n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}),e}function jt(t){if(!t)return;const e=document.body,n=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:t.detail});e.dispatchEvent(n)}function I({trackingProps:t,action:e,triggerAction:n}){let o;const s=Rt(),{product:a,app:r,flags:c}=t;s.activeComponent===h?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},...r&&{app:r},custom:[{cookie_toggle_flag:c}],url:window.document.location.href||null}};jt(i)}const Ht={onMessageChoiceSelect:t=>(e,n,o)=>{const a={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];a&&I({trackingProps:t,action:"click",triggerAction:a})},onMessageReady:t=>()=>{I({trackingProps:t,action:"view"})},onMessageReceiveData:()=>(t,e)=>{const{messageId:n}=e;n&&E({messageId:n})},onError:t=>(e,n)=>{I({trackingProps:t,action:"error",triggerAction:n})},onPMCancel:()=>()=>{E({activeComponent:h})}};function qt(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:r="0"}={}}=n;s&&(+r&&E({activeComponent:Lt,privacyManagerId:+r}),!(!a||!o[a])&&I({trackingProps:t,action:"click",triggerAction:o[a]}))},!1)}const Gt="6.0.1";async function Wt(t){const{useFTSession:e=!0,consentProxyHost:n=$,cookieDomain:o=W,formOfWordsId:s=G,useConsentStore:a=!0,trackingContext:r={},disableFTCookies:c=!1,includeUsNat:i=!1}=t||{};let{propertyConfig:p=w,userId:f}=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=Gt,!f&&e)try{const d=await j();f=d==null?void 0:d.uuid}catch(d){console.error(d)}p=$t(p),ft(p,{userId:f,includeUsNat:i}),Pt(),window._sp_queue.push(()=>{var d,g;(g=(d=window._sp_)==null?void 0:d.addEventListener)==null||g.call(d,"onConsentReady",Mt({userId:f,consentProxyHost:n,cookieDomain:o,formOfWordsId:s,useConsentStore:a,disableFTCookies:c,includeUsNat:i}))}),Vt(r,p.baseEndpoint)}function $t(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 U(t,e,n,o,s,a){const{text:r,onClick:c}=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=r,p.addEventListener("click",c),s.set(p,c))}function Kt({_clientOptions:t}=w){const{privacyManagerId:e,ccpaPrivacyManagerId:n,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=t??w._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)}}},r=new Map,c=function(i,p,f,d){U(!1,i,d.applies,a,r,s),d.applies&&window._sp_queue.push(()=>{var g,b;(b=(g=window._sp_).removeEventListener)==null||b.call(g,"onConsentReady",c)})};U(!0,"gdpr",!1,a,r,s),window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var i,p;(p=(i=window._sp_).addEventListener)==null||p.call(i,"onConsentReady",c)})}function Bt(t){return t._clientOptions??{}}const Jt={"ft.com":Bt};function Xt(t){return new Promise((e,n)=>{const{rootDomain:o}=t._clientOptions||{};if(!o)return e({});const s=Jt[o];if(!s||typeof s!="function")return e({...t._clientOptions});const a=()=>{try{e(s(t))}catch(r){n(r)}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()})}function Yt(t,e){if(!e||Number.isFinite(parseFloat(e))||!t.endsWith(e))return!1;const n=t.indexOf(e),o=t[n-1];return o==="."||o===void 0}function zt(t){if(!t)throw new Error("Invalid hostname provided");let n=Object.values(ct).find(o=>{var a;if(o.propertyHref)return!1;const s=(a=o._clientOptions)==null?void 0:a.rootDomain;return s&&Yt(t,s)});return n??(n=k),n}const Zt=new URL(window.location.href).hostname,l=zt(Zt);(async()=>{var t,e;try{const n=await Xt(l);Wt({propertyConfig:l,...n}),(t=l==null?void 0:l._clientOptions)!=null&&t.privacyManagerId&&((e=l==null?void 0:l._clientOptions)!=null&&e.manageCookiesLinkOverride)&&Kt(l)}catch(n){console.error("Error: CMP package configure + initialise Sourcepoint failed.",n)}})()})();
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { SPConfig, regionConfig } from "../../typings/types";
|
|
2
|
-
declare function findAndUpdateLinks(fallback: boolean, regionId: string, regionApplies: boolean, regionConfig: regionConfig, linkMap: Map<HTMLElement, (this: HTMLElement, ev: MouseEvent) => void>, manageCookiesLinkOverride?: string): void;
|
|
2
|
+
export declare function findAndUpdateLinks(fallback: boolean, regionId: string, regionApplies: boolean, regionConfig: regionConfig, linkMap: Map<HTMLElement, (this: HTMLElement, ev: MouseEvent) => void>, manageCookiesLinkOverride?: string): void;
|
|
3
3
|
export declare function interceptManageCookiesLinks({ _clientOptions }?: SPConfig): void;
|
|
4
|
-
export declare const exportedForTesting: {
|
|
5
|
-
findAndUpdateLinks: typeof findAndUpdateLinks;
|
|
6
|
-
};
|
|
7
|
-
export {};
|
|
8
4
|
//# sourceMappingURL=cmp-manage-cookies-link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmp-manage-cookies-link.d.ts","sourceRoot":"","sources":["../../../src/html/cmp-manage-cookies-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIlE,
|
|
1
|
+
{"version":3,"file":"cmp-manage-cookies-link.d.ts","sourceRoot":"","sources":["../../../src/html/cmp-manage-cookies-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIlE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,KAAK,IAAI,CAAC,EACtE,yBAAyB,CAAC,EAAE,MAAM,QAenC;AAED,wBAAgB,2BAA2B,CAAC,EAAE,cAAc,EAAE,GAAE,QAAyB,QA+DxF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IabCustomCategoryName } from "../../typings/types.d.ts";
|
|
1
2
|
export declare const SOURCEPOINT_CONSENT_SOURCE = "sourcepoint-cmp";
|
|
2
3
|
export declare const SOURCEPOINT_FOW_SCOPE = "FTPINK";
|
|
3
4
|
export declare const CONSENT_COOKIE_NAME = "FTConsent";
|
|
@@ -36,5 +37,5 @@ export declare const iabCustomCategories: {
|
|
|
36
37
|
readonly specialFeatures: readonly [];
|
|
37
38
|
};
|
|
38
39
|
};
|
|
39
|
-
export declare const iabCategoryNames:
|
|
40
|
+
export declare const iabCategoryNames: IabCustomCategoryName[];
|
|
40
41
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAC5D,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C,eAAO,MAAM,kBAAkB,oDAAoD,CAAC;AACpF,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAE9D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BtB,CAAC;AAEX,eAAO,MAAM,gBAAgB,EAAuC,qBAAqB,EAAE,CAAC"}
|
|
@@ -173,4 +173,24 @@ export declare const SP_GLOBAL_PRIVATE_BANKING_AWARDS: {
|
|
|
173
173
|
joinHref: boolean;
|
|
174
174
|
gdpr: {};
|
|
175
175
|
};
|
|
176
|
+
export declare const TNW: {
|
|
177
|
+
accountId: number;
|
|
178
|
+
baseEndpoint: string;
|
|
179
|
+
propertyId: number;
|
|
180
|
+
_clientOptions: {
|
|
181
|
+
rootDomain: string;
|
|
182
|
+
};
|
|
183
|
+
joinHref: boolean;
|
|
184
|
+
gdpr: {};
|
|
185
|
+
};
|
|
186
|
+
export declare const INVISSO: {
|
|
187
|
+
accountId: number;
|
|
188
|
+
baseEndpoint: string;
|
|
189
|
+
propertyId: number;
|
|
190
|
+
_clientOptions: {
|
|
191
|
+
rootDomain: string;
|
|
192
|
+
};
|
|
193
|
+
joinHref: boolean;
|
|
194
|
+
gdpr: {};
|
|
195
|
+
};
|
|
176
196
|
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/lib/properties.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;CAW1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;CAa1B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;CAQrB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;CAQ/B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAQhC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;CAQlC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAQ3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;CAQ7B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAQ3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;CAU3B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;CAQjC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;CAQxC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;CAQ5C,CAAC"}
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/lib/properties.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;CAW1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;CAa1B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;CAQrB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;CAQ/B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAQhC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;CAQlC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAQ3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;CAQ7B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAQ3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;CAU3B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;CAQjC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;CAQxC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;CAQ5C,CAAC;AAEF,eAAO,MAAM,GAAG;;;;;;;;;CAQf,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;CAQnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/tracking/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AASjE,eAAO,MAAM,aAAa;;;;EAIxB,CAAC;AAIH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAOzD;AAGD,eAAO,MAAM,QAAQ;;qBAvBF,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/tracking/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AASjE,eAAO,MAAM,aAAa;;;;EAIxB,CAAC;AAIH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAOzD;AAGD,eAAO,MAAM,QAAQ;;qBAvBF,OAAO,cAAc,GAAG,OAAO,eAAe;eACpD,MAAM;sBACC,MAAM;CAqByB,CAAC;AAEpD,eAAO,MAAM,QAAQ,aAAc,OAAO,SAOzC,CAAC"}
|
package/dist/src/utils/url.d.ts
CHANGED
|
@@ -163,5 +163,23 @@ export declare function getPropertyConfigByHostname(hostname: string): {
|
|
|
163
163
|
};
|
|
164
164
|
joinHref: boolean;
|
|
165
165
|
gdpr: {};
|
|
166
|
+
} | {
|
|
167
|
+
accountId: number;
|
|
168
|
+
baseEndpoint: string;
|
|
169
|
+
propertyId: number;
|
|
170
|
+
_clientOptions: {
|
|
171
|
+
rootDomain: string;
|
|
172
|
+
};
|
|
173
|
+
joinHref: boolean;
|
|
174
|
+
gdpr: {};
|
|
175
|
+
} | {
|
|
176
|
+
accountId: number;
|
|
177
|
+
baseEndpoint: string;
|
|
178
|
+
propertyId: number;
|
|
179
|
+
_clientOptions: {
|
|
180
|
+
rootDomain: string;
|
|
181
|
+
};
|
|
182
|
+
joinHref: boolean;
|
|
183
|
+
gdpr: {};
|
|
166
184
|
};
|
|
167
185
|
//# sourceMappingURL=url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAWtE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAWtE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/cmp-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -20,12 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/uuid": "^9.0.8",
|
|
23
|
-
"eslint": "^8.56.0",
|
|
24
23
|
"npm-run-all": "^4.1.5",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"vitest": "^1.2.2"
|
|
24
|
+
"typescript": "^5.7.3",
|
|
25
|
+
"vite": "^6.1.1",
|
|
26
|
+
"vitest": "^3.0.6"
|
|
29
27
|
},
|
|
30
28
|
"scripts": {
|
|
31
29
|
"lint": "eslint ./src ./typings --ext .ts",
|
|
@@ -33,10 +31,11 @@
|
|
|
33
31
|
"checks:unit": "npm t -- --run",
|
|
34
32
|
"checks:types": "tsc",
|
|
35
33
|
"checks": "run-s checks:*",
|
|
34
|
+
"build:clean": "rm -rf ./dist",
|
|
36
35
|
"build:lib": "vite build --config vite.config.lib.ts",
|
|
37
36
|
"build:static": "vite build --config vite.config.static.ts",
|
|
38
37
|
"build:types": "tsc",
|
|
39
|
-
"build": "
|
|
38
|
+
"build": "run-s build:*",
|
|
40
39
|
"test": "vitest"
|
|
41
40
|
}
|
|
42
41
|
}
|