@financial-times/cmp-client 4.0.0 → 4.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.cjs +79 -32
- package/dist/index.js +79 -32
- package/dist/scripts/cmp-static.js +1 -1
- package/dist/src/html/__tests__/cmp-manage-cookies-links.test.d.ts +2 -0
- package/dist/src/html/__tests__/cmp-manage-cookies-links.test.d.ts.map +1 -0
- package/dist/src/html/cmp-manage-cookies-link.d.ts +6 -9
- package/dist/src/html/cmp-manage-cookies-link.d.ts.map +1 -1
- package/dist/src/lib/constants.d.ts +2 -2
- package/dist/src/lib/properties.d.ts +13 -0
- package/dist/src/lib/properties.d.ts.map +1 -1
- package/dist/src/utils/url.d.ts +12 -0
- package/dist/src/utils/url.d.ts.map +1 -1
- package/package.json +1 -1
- package/typings/globals.d.ts +3 -0
- package/typings/types.d.ts +16 -0
package/README.md
CHANGED
|
@@ -266,6 +266,8 @@ npm run dev -w src/examples/cmp-client
|
|
|
266
266
|
|
|
267
267
|
Visit https://localhost:5173 (see setup details in `src/examples/cmp-client`) to interact with the banner and see how cookies are set accordingly
|
|
268
268
|
|
|
269
|
+
> For resetting your consent cookies/record and other common troubleshooting issues, see the [Troubleshooting Guide](./docs/troubleshooting.md)
|
|
270
|
+
|
|
269
271
|
#### Resources
|
|
270
272
|
|
|
271
273
|
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
|
@@ -66,6 +66,8 @@ const FT_DOTCOM_PROD = {
|
|
|
66
66
|
propertyId: 31642,
|
|
67
67
|
_clientOptions: {
|
|
68
68
|
privacyManagerId: 827767,
|
|
69
|
+
usnatPrivacyManagerId: 944881,
|
|
70
|
+
ccpaPrivacyManagerId: 944882,
|
|
69
71
|
manageCookiesLinkOverride: "ft.com/preferences/manage-cookies",
|
|
70
72
|
rootDomain: "ft.com"
|
|
71
73
|
}
|
|
@@ -151,6 +153,15 @@ const MM_IGNITES_EUROPE = {
|
|
|
151
153
|
rootDomain: "igniteseurope.com"
|
|
152
154
|
}
|
|
153
155
|
};
|
|
156
|
+
const SP_MANDATE_WIRE = {
|
|
157
|
+
...defaults,
|
|
158
|
+
accountId: 1906,
|
|
159
|
+
baseEndpoint: "https://consent-manager.mandatewire.com",
|
|
160
|
+
propertyId: 35490,
|
|
161
|
+
_clientOptions: {
|
|
162
|
+
rootDomain: "mandatewire.com"
|
|
163
|
+
}
|
|
164
|
+
};
|
|
154
165
|
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
155
166
|
__proto__: null,
|
|
156
167
|
FT_DOTCOM_PROD,
|
|
@@ -161,44 +172,80 @@ const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
161
172
|
SP_FDI_INTELLIGENCE,
|
|
162
173
|
SP_FT_ADVISER,
|
|
163
174
|
SP_INVESTORS_CHRONICLE,
|
|
175
|
+
SP_MANDATE_WIRE,
|
|
164
176
|
SP_PWMNET,
|
|
165
177
|
SP_SUSTAINABLE_VIEWS,
|
|
166
178
|
SP_THE_BANKER
|
|
167
179
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return resolve();
|
|
171
|
-
const isReady = () => ["interactive", "complete"].includes(document.readyState);
|
|
172
|
-
function onStateChange() {
|
|
173
|
-
if (isReady()) {
|
|
174
|
-
document.removeEventListener("readystatechange", onStateChange);
|
|
175
|
-
resolve();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (isReady())
|
|
179
|
-
return resolve();
|
|
180
|
-
document.addEventListener("readystatechange", onStateChange);
|
|
181
|
-
});
|
|
182
|
-
function findAndUpdateLinks(_clientOptions, loadPrivacyManagerModal) {
|
|
183
|
-
const { privacyManagerId, manageCookiesLinkOverride } = _clientOptions ?? {};
|
|
184
|
-
if (!privacyManagerId || !manageCookiesLinkOverride) {
|
|
185
|
-
return console.warn("_clientOptions is missing privacyManagerId or manageCookiesLinkOverride");
|
|
186
|
-
}
|
|
180
|
+
function findAndUpdateLinks(fallback, regionId, regionApplies, regionConfig, linkMap, manageCookiesLinkOverride) {
|
|
181
|
+
const { text, onClick } = regionConfig[regionId];
|
|
187
182
|
const anchors = document.querySelectorAll(`a[href*="${manageCookiesLinkOverride}"]`);
|
|
188
183
|
for (const anchor of anchors) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
if (regionApplies || fallback) {
|
|
185
|
+
if (linkMap.has(anchor)) {
|
|
186
|
+
anchor.removeEventListener("click", linkMap.get(anchor));
|
|
187
|
+
}
|
|
188
|
+
anchor.innerText = text;
|
|
189
|
+
anchor.addEventListener("click", onClick);
|
|
190
|
+
linkMap.set(anchor, onClick);
|
|
191
|
+
}
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
194
|
function interceptManageCookiesLinks({ _clientOptions } = FT_DOTCOM_PROD) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
195
|
+
const {
|
|
196
|
+
privacyManagerId,
|
|
197
|
+
ccpaPrivacyManagerId,
|
|
198
|
+
usnatPrivacyManagerId,
|
|
199
|
+
manageCookiesLinkOverride
|
|
200
|
+
} = _clientOptions ?? FT_DOTCOM_PROD._clientOptions;
|
|
201
|
+
const regionConfig = {
|
|
202
|
+
usnat: {
|
|
203
|
+
text: "Do not sell my data",
|
|
204
|
+
onClick: (e) => {
|
|
205
|
+
var _a;
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
(_a = window._sp_["usnat"]) == null ? void 0 : _a.loadPrivacyManagerModal(usnatPrivacyManagerId);
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
ccpa: {
|
|
211
|
+
text: "Do not sell my data",
|
|
212
|
+
onClick: (e) => {
|
|
213
|
+
var _a;
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
(_a = window._sp_["ccpa"]) == null ? void 0 : _a.loadPrivacyManagerModal(ccpaPrivacyManagerId);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
gdpr: {
|
|
219
|
+
text: "Manage cookies",
|
|
220
|
+
onClick: (e) => {
|
|
221
|
+
var _a;
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
(_a = window._sp_["gdpr"]) == null ? void 0 : _a.loadPrivacyManagerModal(privacyManagerId);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
const linkMap = /* @__PURE__ */ new Map();
|
|
228
|
+
const onConsentReadyHandler = function(message_type, _uuid, _string, info) {
|
|
229
|
+
console.log("handler called");
|
|
230
|
+
findAndUpdateLinks(
|
|
231
|
+
false,
|
|
232
|
+
message_type,
|
|
233
|
+
info.applies,
|
|
234
|
+
regionConfig,
|
|
235
|
+
linkMap,
|
|
236
|
+
manageCookiesLinkOverride
|
|
237
|
+
);
|
|
238
|
+
if (info.applies) {
|
|
239
|
+
window._sp_queue.push(() => {
|
|
240
|
+
var _a, _b;
|
|
241
|
+
(_b = (_a = window._sp_).removeEventListener) == null ? void 0 : _b.call(_a, "onConsentReady", onConsentReadyHandler);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
findAndUpdateLinks(true, "gdpr", false, regionConfig, linkMap, manageCookiesLinkOverride);
|
|
246
|
+
window._sp_queue.push(() => {
|
|
247
|
+
var _a, _b;
|
|
248
|
+
(_b = (_a = window._sp_).addEventListener) == null ? void 0 : _b.call(_a, "onConsentReady", onConsentReadyHandler);
|
|
202
249
|
});
|
|
203
250
|
}
|
|
204
251
|
const request = (url, { credentials = "omit" } = {}) => {
|
|
@@ -285,7 +332,7 @@ const iabCustomCategories = {
|
|
|
285
332
|
specialFeatures: []
|
|
286
333
|
},
|
|
287
334
|
demographicAds: {
|
|
288
|
-
purposes: [
|
|
335
|
+
purposes: [7, 9, 10],
|
|
289
336
|
iabVendors: [],
|
|
290
337
|
customVendors: [],
|
|
291
338
|
specialFeatures: []
|
|
@@ -303,7 +350,7 @@ const iabCustomCategories = {
|
|
|
303
350
|
specialFeatures: []
|
|
304
351
|
},
|
|
305
352
|
personalisedMarketing: {
|
|
306
|
-
purposes: [
|
|
353
|
+
purposes: [2, 7, 8, 9, 10],
|
|
307
354
|
iabVendors: [],
|
|
308
355
|
customVendors: [],
|
|
309
356
|
specialFeatures: []
|
|
@@ -640,7 +687,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
640
687
|
false
|
|
641
688
|
);
|
|
642
689
|
}
|
|
643
|
-
const version = "4.0.
|
|
690
|
+
const version = "4.2.0-beta.1";
|
|
644
691
|
async function initSourcepointCmp({
|
|
645
692
|
propertyConfig = FT_DOTCOM_PROD,
|
|
646
693
|
userId,
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,8 @@ const FT_DOTCOM_PROD = {
|
|
|
64
64
|
propertyId: 31642,
|
|
65
65
|
_clientOptions: {
|
|
66
66
|
privacyManagerId: 827767,
|
|
67
|
+
usnatPrivacyManagerId: 944881,
|
|
68
|
+
ccpaPrivacyManagerId: 944882,
|
|
67
69
|
manageCookiesLinkOverride: "ft.com/preferences/manage-cookies",
|
|
68
70
|
rootDomain: "ft.com"
|
|
69
71
|
}
|
|
@@ -149,6 +151,15 @@ const MM_IGNITES_EUROPE = {
|
|
|
149
151
|
rootDomain: "igniteseurope.com"
|
|
150
152
|
}
|
|
151
153
|
};
|
|
154
|
+
const SP_MANDATE_WIRE = {
|
|
155
|
+
...defaults,
|
|
156
|
+
accountId: 1906,
|
|
157
|
+
baseEndpoint: "https://consent-manager.mandatewire.com",
|
|
158
|
+
propertyId: 35490,
|
|
159
|
+
_clientOptions: {
|
|
160
|
+
rootDomain: "mandatewire.com"
|
|
161
|
+
}
|
|
162
|
+
};
|
|
152
163
|
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
153
164
|
__proto__: null,
|
|
154
165
|
FT_DOTCOM_PROD,
|
|
@@ -159,44 +170,80 @@ const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
159
170
|
SP_FDI_INTELLIGENCE,
|
|
160
171
|
SP_FT_ADVISER,
|
|
161
172
|
SP_INVESTORS_CHRONICLE,
|
|
173
|
+
SP_MANDATE_WIRE,
|
|
162
174
|
SP_PWMNET,
|
|
163
175
|
SP_SUSTAINABLE_VIEWS,
|
|
164
176
|
SP_THE_BANKER
|
|
165
177
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return resolve();
|
|
169
|
-
const isReady = () => ["interactive", "complete"].includes(document.readyState);
|
|
170
|
-
function onStateChange() {
|
|
171
|
-
if (isReady()) {
|
|
172
|
-
document.removeEventListener("readystatechange", onStateChange);
|
|
173
|
-
resolve();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (isReady())
|
|
177
|
-
return resolve();
|
|
178
|
-
document.addEventListener("readystatechange", onStateChange);
|
|
179
|
-
});
|
|
180
|
-
function findAndUpdateLinks(_clientOptions, loadPrivacyManagerModal) {
|
|
181
|
-
const { privacyManagerId, manageCookiesLinkOverride } = _clientOptions ?? {};
|
|
182
|
-
if (!privacyManagerId || !manageCookiesLinkOverride) {
|
|
183
|
-
return console.warn("_clientOptions is missing privacyManagerId or manageCookiesLinkOverride");
|
|
184
|
-
}
|
|
178
|
+
function findAndUpdateLinks(fallback, regionId, regionApplies, regionConfig, linkMap, manageCookiesLinkOverride) {
|
|
179
|
+
const { text, onClick } = regionConfig[regionId];
|
|
185
180
|
const anchors = document.querySelectorAll(`a[href*="${manageCookiesLinkOverride}"]`);
|
|
186
181
|
for (const anchor of anchors) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
182
|
+
if (regionApplies || fallback) {
|
|
183
|
+
if (linkMap.has(anchor)) {
|
|
184
|
+
anchor.removeEventListener("click", linkMap.get(anchor));
|
|
185
|
+
}
|
|
186
|
+
anchor.innerText = text;
|
|
187
|
+
anchor.addEventListener("click", onClick);
|
|
188
|
+
linkMap.set(anchor, onClick);
|
|
189
|
+
}
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
function interceptManageCookiesLinks({ _clientOptions } = FT_DOTCOM_PROD) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
193
|
+
const {
|
|
194
|
+
privacyManagerId,
|
|
195
|
+
ccpaPrivacyManagerId,
|
|
196
|
+
usnatPrivacyManagerId,
|
|
197
|
+
manageCookiesLinkOverride
|
|
198
|
+
} = _clientOptions ?? FT_DOTCOM_PROD._clientOptions;
|
|
199
|
+
const regionConfig = {
|
|
200
|
+
usnat: {
|
|
201
|
+
text: "Do not sell my data",
|
|
202
|
+
onClick: (e) => {
|
|
203
|
+
var _a;
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
(_a = window._sp_["usnat"]) == null ? void 0 : _a.loadPrivacyManagerModal(usnatPrivacyManagerId);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
ccpa: {
|
|
209
|
+
text: "Do not sell my data",
|
|
210
|
+
onClick: (e) => {
|
|
211
|
+
var _a;
|
|
212
|
+
e.preventDefault();
|
|
213
|
+
(_a = window._sp_["ccpa"]) == null ? void 0 : _a.loadPrivacyManagerModal(ccpaPrivacyManagerId);
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
gdpr: {
|
|
217
|
+
text: "Manage cookies",
|
|
218
|
+
onClick: (e) => {
|
|
219
|
+
var _a;
|
|
220
|
+
e.preventDefault();
|
|
221
|
+
(_a = window._sp_["gdpr"]) == null ? void 0 : _a.loadPrivacyManagerModal(privacyManagerId);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const linkMap = /* @__PURE__ */ new Map();
|
|
226
|
+
const onConsentReadyHandler = function(message_type, _uuid, _string, info) {
|
|
227
|
+
console.log("handler called");
|
|
228
|
+
findAndUpdateLinks(
|
|
229
|
+
false,
|
|
230
|
+
message_type,
|
|
231
|
+
info.applies,
|
|
232
|
+
regionConfig,
|
|
233
|
+
linkMap,
|
|
234
|
+
manageCookiesLinkOverride
|
|
235
|
+
);
|
|
236
|
+
if (info.applies) {
|
|
237
|
+
window._sp_queue.push(() => {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
(_b = (_a = window._sp_).removeEventListener) == null ? void 0 : _b.call(_a, "onConsentReady", onConsentReadyHandler);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
findAndUpdateLinks(true, "gdpr", false, regionConfig, linkMap, manageCookiesLinkOverride);
|
|
244
|
+
window._sp_queue.push(() => {
|
|
245
|
+
var _a, _b;
|
|
246
|
+
(_b = (_a = window._sp_).addEventListener) == null ? void 0 : _b.call(_a, "onConsentReady", onConsentReadyHandler);
|
|
200
247
|
});
|
|
201
248
|
}
|
|
202
249
|
const request = (url, { credentials = "omit" } = {}) => {
|
|
@@ -283,7 +330,7 @@ const iabCustomCategories = {
|
|
|
283
330
|
specialFeatures: []
|
|
284
331
|
},
|
|
285
332
|
demographicAds: {
|
|
286
|
-
purposes: [
|
|
333
|
+
purposes: [7, 9, 10],
|
|
287
334
|
iabVendors: [],
|
|
288
335
|
customVendors: [],
|
|
289
336
|
specialFeatures: []
|
|
@@ -301,7 +348,7 @@ const iabCustomCategories = {
|
|
|
301
348
|
specialFeatures: []
|
|
302
349
|
},
|
|
303
350
|
personalisedMarketing: {
|
|
304
|
-
purposes: [
|
|
351
|
+
purposes: [2, 7, 8, 9, 10],
|
|
305
352
|
iabVendors: [],
|
|
306
353
|
customVendors: [],
|
|
307
354
|
specialFeatures: []
|
|
@@ -638,7 +685,7 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
638
685
|
false
|
|
639
686
|
);
|
|
640
687
|
}
|
|
641
|
-
const version = "4.0.
|
|
688
|
+
const version = "4.2.0-beta.1";
|
|
642
689
|
async function initSourcepointCmp({
|
|
643
690
|
propertyConfig = FT_DOTCOM_PROD,
|
|
644
691
|
userId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var T,k;const N=(e,{credentials:t="omit"}={})=>fetch(`https://session-next.ft.com${e}`,{credentials:t,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 l={};const g=(e,t)=>{if(typeof e=="object"){l=e;return}if(typeof e=="string"&&typeof t=="string"){l[e]=t;return}if(typeof e=="string"&&typeof t>"u")return l[e]||null;if(typeof e>"u"&&typeof t>"u")return l;throw new Error("Invalid arguments")};g.clear=()=>{l={}};const f={},L=()=>{const[,e]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return e},P=()=>{const e=g("uuid");if(e)return Promise.resolve({uuid:e});const t=L();return t?(f.uuid||(f.uuid=N(`/sessions/s/${t}`).then(({uuid:n}={})=>(delete f.uuid,n&&g("uuid",n),{uuid:n}))),f.uuid):Promise.resolve({uuid:void 0})},v="sourcepoint-cmp",M="FTPINK",A="FTConsent",R="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",D=".ft.com",F="https://consent.ft.com",I={permutiveAds:{purposes:[2,4,8,9],iabVendors:[361],customVendors:[],specialFeatures:[]},demographicAds:{purposes:[3,4,7,9,10],iabVendors:[],customVendors:[],specialFeatures:[]},behaviouralAds:{purposes:[2,4,8,9],iabVendors:[],customVendors:[],specialFeatures:[]},programmaticAds:{purposes:[2],iabVendors:[],customVendors:[],specialFeatures:[]},personalisedMarketing:{purposes:[1,4,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]}},E=Object.keys(I),u={joinHref:!0,gdpr:{},ccpa:{}},w={...u,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyHref:"https://local.ft.com",_clientOptions:{privacyManagerId:827767,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies"}},y={...u,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyId:31642,_clientOptions:{privacyManagerId:827767,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies",rootDomain:"ft.com"}},V={...u,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com"}},j={...u,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com"}},H={...u,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com"}},U={...u,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com"}},x={...u,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com"}},q={...u,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com"}},$={...u,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk"}},G={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},K={...u,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},W=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:y,FT_DOTCOM_TEST:w,MM_IGNITES_ASIA:G,MM_IGNITES_EUROPE:K,SP_BANKING_RR:U,SP_FDI_INTELLIGENCE:j,SP_FT_ADVISER:q,SP_INVESTORS_CHRONICLE:$,SP_PWMNET:V,SP_SUSTAINABLE_VIEWS:x,SP_THE_BANKER:H},Symbol.toStringTag,{value:"Module"}));function O(e,t){const n=document.createElement("script");return n.dataset.cmpScript=e,n.innerHTML=t,n}function B(e){const t=document.createElement("script");return t.src=e,t}const J={cmpFrames:"https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"},S={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()}();',uspStub:'"use strict";(function () { var e = false; var c = window; var t = document; function r() { if (!c.frames["__uspapiLocator"]) { if (t.body) { var a = t.body; var e = t.createElement("iframe"); e.style.cssText = "display:none"; e.name = "__uspapiLocator"; e.title = "__uspapiLocator";a.appendChild(e) } else { setTimeout(r, 5) } } } r(); function p() { var a = arguments; __uspapi.a = __uspapi.a || []; if (!a.length) { return __uspapi.a } else if (a[0] === "ping") { a[2]({ gdprAppliesGlobally: e, cmpLoaded: false }, true) } else { __uspapi.a.push([].slice.apply(a)) } } function l(t) { var r = typeof t.data === "string"; try { var a = r ? JSON.parse(t.data) : t.data; if (a.__cmpCall) { var n = a.__cmpCall; c.__uspapi(n.command, n.parameter, function (a, e) { var c = { __cmpReturn: { returnValue: a, success: e, callId: n.callId } }; t.source.postMessage(r ? JSON.stringify(c) : c, "*") }) } } catch (a) { } } if (typeof __uspapi !== "function") { c.__uspapi = p; __uspapi.msgHandler = l; c.addEventListener("message", l, false) } })();'};function X(){const e=document.createDocumentFragment();return e.appendChild(O("tcf",S.tcfStub)),e.appendChild(O("usp",S.uspStub)),e.appendChild(B(J.cmpFrames)),e}function Y(e){const{_clientOptions:t,...n}=e;window._sp_={config:n},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(X())}function z(e,t,{formOfWordsId:n,cookieDomain:o}){const c=Object.keys(e).reduce((r,p)=>(r[p]={onsite:{status:e[p],lbi:!1,source:v,fow:n}},r),{});return t?{setConsentCookie:!0,formOfWordsId:n,consentSource:v,cookieDomain:o,data:c}:{data:c,cookieDomain:o}}function Z(e,{purpose:t,vendor:n,specialFeatureOptins:o}){const s=I[e],c=s.purposes.every(i=>(t==null?void 0:t.consents[i])||(t==null?void 0:t.legitimateInterests[i])),r=s.iabVendors.every(i=>(n==null?void 0:n.consents[i])||(n==null?void 0:n.legitimateInterests[i])),p=s.specialFeatures.every(i=>(o==null?void 0:o[i])===!0);return c&&r&&p}function Q(e){const t=(e==null?void 0:e[2])==="N",n={};for(const o of E)n[o]=t;return n}async function ee(){const e=await new Promise((n,o)=>{var s;try{(s=window.__tcfapi)==null||s.call(window,"addEventListener",2,n)}catch(c){o(c)}}),t={};for(const n of E)t[n]=Z(n,e);return t}async function te(e,t){return e==="ccpa"?Q(t):await ee()}function ne(){const t=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[A];if(!t)return{};const n=decodeURIComponent(t);return Object.fromEntries(n.split(",").map(o=>{const[s,c]=o.split(":");return[s,c==="on"]}))}function oe(e,t){return Object.keys(e).some(o=>{const s=`${o.toLowerCase()}Onsite`;return e[o]!==t[s]})}function se({userId:e,useConsentStore:t}){return!!e&&t===!0}function ce(e,t){return e?`${t.consentProxyHost}/__consent/consent-record/${M}/${t.userId}`:`${t.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${t.cookieDomain}`}async function re(e,t){try{const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),credentials:"include"});n.ok||console.error("Unable to save consent preferences",n.status)}catch(n){console.error("An error occurred while saving consent",n)}}function ae(e){return async function(n,o,s,c){if(e.disableFTCookies)return;const r=c.applies?n:"gdpr";if(r!==n||!s)return;const p=await te(r,s);if(!oe(p,ne()))return;const a=se(e),_=ce(a,e),Oe=z(p,a,e);await re(_,Oe),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const b="cookie-message",ie="manage-cookies";let h=Object.freeze({activeComponent:b,messageId:0,privacyManagerId:0});function ue(e){return typeof e=="object"&&e!==null&&e.constructor===Object&&Object.prototype.toString.call(e)==="[object Object]"}const pe=()=>({...h}),C=e=>{if(!ue(e)){console.error("Invalid state changes");return}h={...h,...e}},de=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function le(e,t){const n=fe(e.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[c,r]of Object.entries(_e))(s=(o=window._sp_).addEventListener)==null||s.call(o,c,r({...e,flags:n}))}),ge({...e,flags:n},t)}function fe(e){const t={};return typeof e=="object"&&de.forEach(n=>{Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}),t}function me(e){if(!e)return;const t=document.body,n=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:e.detail});t.dispatchEvent(n)}function m({trackingProps:e,action:t,triggerAction:n}){let o;const s=pe(),{product:c,app:r,flags:p}=e;s.activeComponent===b?o=s.messageId:o=s.privacyManagerId;const i={detail:{component:{id:o,name:s.activeComponent,type:"overlay",subtype:"cmp"},category:"component",action:t,...n&&{trigger_action:n},...c&&{product:c},...r&&{app:r},custom:[{cookie_toggle_flag:p}],url:window.document.location.href||null}};me(i)}const _e={onMessageChoiceSelect:e=>(t,n,o)=>{const c={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];c&&m({trackingProps:e,action:"click",triggerAction:c})},onMessageReady:e=>()=>{m({trackingProps:e,action:"view"})},onMessageReceiveData:()=>(e,t)=>{const{messageId:n}=t;n&&C({messageId:n})},onError:e=>(t,n)=>{m({trackingProps:e,action:"error",triggerAction:n})},onPMCancel:()=>()=>{C({activeComponent:b})}};function ge(e,t){window.addEventListener("message",function(n){if(n.origin!==t)return;const o={1:"save_and_close",11:"accept_all",13:"reject_all"},{data:{fromPM:s,actionType:c,messageId:r="0"}={}}=n;s&&(+r&&C({activeComponent:ie,privacyManagerId:+r}),!(!c||!o[c])&&m({trackingProps:e,action:"click",triggerAction:o[c]}))},!1)}const ye="4.0.0";async function be({propertyConfig:e=y,userId:t,useFTSession:n=!0,consentProxyHost:o=F,cookieDomain:s=D,formOfWordsId:c=R,useConsentStore:r=!0,trackingContext:p={},disableFTCookies:i=!1}={}){if(typeof window>"u"){console.error("The CMP client can only be initialised in a browser context");return}if(window.FT_CMP_CLIENT_VERSION=ye,!t&&n)try{const a=await P();t=a==null?void 0:a.uuid}catch(a){console.error(a)}if(!(e!=null&&e.accountId))throw new Error("Please pass a valid property config");t&&(e.authId=t),e.events&&(console.warn("[cmp-client] Passing an events map in the config is not supported and will be ignored. Please use window._sp_.addEventListener() to listen for events"),delete e.events),Y(e),window._sp_queue.push(()=>{var a,_;(_=(a=window._sp_)==null?void 0:a.addEventListener)==null||_.call(a,"onConsentReady",ae({userId:t,consentProxyHost:o,cookieDomain:s,formOfWordsId:c,useConsentStore:r,disableFTCookies:i}))}),le(p,e.baseEndpoint)}const he=new Promise(e=>{if(typeof document>"u")return e();const t=()=>["interactive","complete"].includes(document.readyState);function n(){t()&&(document.removeEventListener("readystatechange",n),e())}if(t())return e();document.addEventListener("readystatechange",n)});function Ce(e,t){const{privacyManagerId:n,manageCookiesLinkOverride:o}=e??{};if(!n||!o)return console.warn("_clientOptions is missing privacyManagerId or manageCookiesLinkOverride");const s=document.querySelectorAll(`a[href*="${o}"]`);for(const c of s)c.addEventListener("click",r=>{r.preventDefault(),t==null||t(+n)})}function ve({_clientOptions:e}=y){he.then(()=>{window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var t,n;Ce(e,(n=(t=window._sp_)==null?void 0:t.gdpr)==null?void 0:n.loadPrivacyManagerModal)})})}function Ie(e,t){if(!t||Number.isFinite(parseFloat(t))||!e.endsWith(t))return!1;const n=e.indexOf(t),o=e[n-1];return o==="."||o===void 0}function Ee(e){if(!e)throw new Error("Invalid hostname provided");let n=Object.values(W).find(o=>{var c;const s=(c=o._clientOptions)==null?void 0:c.rootDomain;return s&&Ie(e,s)});return n??(n=w),n}const we=new URL(window.location.href).hostname,d=Ee(we);be({propertyConfig:d}),(T=d==null?void 0:d._clientOptions)!=null&&T.privacyManagerId&&((k=d==null?void 0:d._clientOptions)!=null&&k.manageCookiesLinkOverride)&&ve(d)})();
|
|
1
|
+
(function(){"use strict";var M,P;const D=(e,{credentials:t="omit"}={})=>fetch(`https://session-next.ft.com${e}`,{credentials:t,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 l={};const v=(e,t)=>{if(typeof e=="object"){l=e;return}if(typeof e=="string"&&typeof t=="string"){l[e]=t;return}if(typeof e=="string"&&typeof t>"u")return l[e]||null;if(typeof e>"u"&&typeof t>"u")return l;throw new Error("Invalid arguments")};v.clear=()=>{l={}};const m={},A=()=>{const[,e]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return e},R=()=>{const e=v("uuid");if(e)return Promise.resolve({uuid:e});const t=A();return t?(m.uuid||(m.uuid=D(`/sessions/s/${t}`).then(({uuid:n}={})=>(delete m.uuid,n&&v("uuid",n),{uuid:n}))),m.uuid):Promise.resolve({uuid:void 0})},I="sourcepoint-cmp",F="FTPINK",V="FTConsent",j="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",H=".ft.com",x="https://consent.ft.com",w={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:[]}},E=Object.keys(w),d={joinHref:!0,gdpr:{},ccpa:{}},O={...d,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyHref:"https://local.ft.com",_clientOptions:{privacyManagerId:827767,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies"}},_={...d,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyId:31642,_clientOptions:{privacyManagerId:827767,usnatPrivacyManagerId:944881,ccpaPrivacyManagerId:944882,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies",rootDomain:"ft.com"}},U={...d,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com"}},q={...d,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com"}},$={...d,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com"}},G={...d,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com"}},W={...d,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com"}},K={...d,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com"}},B={...d,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk"}},J={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},X={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},Y={...d,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com"}},z=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:_,FT_DOTCOM_TEST:O,MM_IGNITES_ASIA:J,MM_IGNITES_EUROPE:X,SP_BANKING_RR:G,SP_FDI_INTELLIGENCE:q,SP_FT_ADVISER:K,SP_INVESTORS_CHRONICLE:B,SP_MANDATE_WIRE:Y,SP_PWMNET:U,SP_SUSTAINABLE_VIEWS:W,SP_THE_BANKER:$},Symbol.toStringTag,{value:"Module"}));function S(e,t){const n=document.createElement("script");return n.dataset.cmpScript=e,n.innerHTML=t,n}function Z(e){const t=document.createElement("script");return t.src=e,t}const Q={cmpFrames:"https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"},k={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()}();',uspStub:'"use strict";(function () { var e = false; var c = window; var t = document; function r() { if (!c.frames["__uspapiLocator"]) { if (t.body) { var a = t.body; var e = t.createElement("iframe"); e.style.cssText = "display:none"; e.name = "__uspapiLocator"; e.title = "__uspapiLocator";a.appendChild(e) } else { setTimeout(r, 5) } } } r(); function p() { var a = arguments; __uspapi.a = __uspapi.a || []; if (!a.length) { return __uspapi.a } else if (a[0] === "ping") { a[2]({ gdprAppliesGlobally: e, cmpLoaded: false }, true) } else { __uspapi.a.push([].slice.apply(a)) } } function l(t) { var r = typeof t.data === "string"; try { var a = r ? JSON.parse(t.data) : t.data; if (a.__cmpCall) { var n = a.__cmpCall; c.__uspapi(n.command, n.parameter, function (a, e) { var c = { __cmpReturn: { returnValue: a, success: e, callId: n.callId } }; t.source.postMessage(r ? JSON.stringify(c) : c, "*") }) } } catch (a) { } } if (typeof __uspapi !== "function") { c.__uspapi = p; __uspapi.msgHandler = l; c.addEventListener("message", l, false) } })();'};function ee(){const e=document.createDocumentFragment();return e.appendChild(S("tcf",k.tcfStub)),e.appendChild(S("usp",k.uspStub)),e.appendChild(Z(Q.cmpFrames)),e}function te(e){const{_clientOptions:t,...n}=e;window._sp_={config:n},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(ee())}function ne(e,t,{formOfWordsId:n,cookieDomain:o}){const a=Object.keys(e).reduce((i,u)=>(i[u]={onsite:{status:e[u],lbi:!1,source:I,fow:n}},i),{});return t?{setConsentCookie:!0,formOfWordsId:n,consentSource:I,cookieDomain:o,data:a}:{data:a,cookieDomain:o}}function oe(e,{purpose:t,vendor:n,specialFeatureOptins:o}){const s=w[e],a=s.purposes.every(r=>(t==null?void 0:t.consents[r])||(t==null?void 0:t.legitimateInterests[r])),i=s.iabVendors.every(r=>(n==null?void 0:n.consents[r])||(n==null?void 0:n.legitimateInterests[r])),u=s.specialFeatures.every(r=>(o==null?void 0:o[r])===!0);return a&&i&&u}function se(e){const t=(e==null?void 0:e[2])==="N",n={};for(const o of E)n[o]=t;return n}async function ce(){const e=await new Promise((n,o)=>{var s;try{(s=window.__tcfapi)==null||s.call(window,"addEventListener",2,n)}catch(a){o(a)}}),t={};for(const n of E)t[n]=oe(n,e);return t}async function ae(e,t){return e==="ccpa"?se(t):await ce()}function re(){const t=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[V];if(!t)return{};const n=decodeURIComponent(t);return Object.fromEntries(n.split(",").map(o=>{const[s,a]=o.split(":");return[s,a==="on"]}))}function ie(e,t){return Object.keys(e).some(o=>{const s=`${o.toLowerCase()}Onsite`;return e[o]!==t[s]})}function ue({userId:e,useConsentStore:t}){return!!e&&t===!0}function de(e,t){return e?`${t.consentProxyHost}/__consent/consent-record/${F}/${t.userId}`:`${t.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${t.cookieDomain}`}async function pe(e,t){try{const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),credentials:"include"});n.ok||console.error("Unable to save consent preferences",n.status)}catch(n){console.error("An error occurred while saving consent",n)}}function le(e){return async function(n,o,s,a){if(e.disableFTCookies)return;const i=a.applies?n:"gdpr";if(i!==n||!s)return;const u=await ae(i,s);if(!ie(u,re()))return;const c=ue(e),f=de(c,e),y=ne(u,c,e);await pe(f,y),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const C="cookie-message",fe="manage-cookies";let b=Object.freeze({activeComponent:C,messageId:0,privacyManagerId:0});function me(e){return typeof e=="object"&&e!==null&&e.constructor===Object&&Object.prototype.toString.call(e)==="[object Object]"}const _e=()=>({...b}),h=e=>{if(!me(e)){console.error("Invalid state changes");return}b={...b,...e}},ge=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function ye(e,t){const n=ve(e.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[a,i]of Object.entries(be))(s=(o=window._sp_).addEventListener)==null||s.call(o,a,i({...e,flags:n}))}),he({...e,flags:n},t)}function ve(e){const t={};return typeof e=="object"&&ge.forEach(n=>{Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}),t}function Ce(e){if(!e)return;const t=document.body,n=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:e.detail});t.dispatchEvent(n)}function g({trackingProps:e,action:t,triggerAction:n}){let o;const s=_e(),{product:a,app:i,flags:u}=e;s.activeComponent===C?o=s.messageId:o=s.privacyManagerId;const r={detail:{component:{id:o,name:s.activeComponent,type:"overlay",subtype:"cmp"},category:"component",action:t,...n&&{trigger_action:n},...a&&{product:a},...i&&{app:i},custom:[{cookie_toggle_flag:u}],url:window.document.location.href||null}};Ce(r)}const be={onMessageChoiceSelect:e=>(t,n,o)=>{const a={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];a&&g({trackingProps:e,action:"click",triggerAction:a})},onMessageReady:e=>()=>{g({trackingProps:e,action:"view"})},onMessageReceiveData:()=>(e,t)=>{const{messageId:n}=t;n&&h({messageId:n})},onError:e=>(t,n)=>{g({trackingProps:e,action:"error",triggerAction:n})},onPMCancel:()=>()=>{h({activeComponent:C})}};function he(e,t){window.addEventListener("message",function(n){if(n.origin!==t)return;const o={1:"save_and_close",11:"accept_all",13:"reject_all"},{data:{fromPM:s,actionType:a,messageId:i="0"}={}}=n;s&&(+i&&h({activeComponent:fe,privacyManagerId:+i}),!(!a||!o[a])&&g({trackingProps:e,action:"click",triggerAction:o[a]}))},!1)}const Ie="4.2.0-beta.1";async function we({propertyConfig:e=_,userId:t,useFTSession:n=!0,consentProxyHost:o=x,cookieDomain:s=H,formOfWordsId:a=j,useConsentStore:i=!0,trackingContext:u={},disableFTCookies:r=!1}={}){if(typeof window>"u"){console.error("The CMP client can only be initialised in a browser context");return}if(window.FT_CMP_CLIENT_VERSION=Ie,!t&&n)try{const c=await R();t=c==null?void 0:c.uuid}catch(c){console.error(c)}if(!(e!=null&&e.accountId))throw new Error("Please pass a valid property config");t&&(e.authId=t),e.events&&(console.warn("[cmp-client] Passing an events map in the config is not supported and will be ignored. Please use window._sp_.addEventListener() to listen for events"),delete e.events),te(e),window._sp_queue.push(()=>{var c,f;(f=(c=window._sp_)==null?void 0:c.addEventListener)==null||f.call(c,"onConsentReady",le({userId:t,consentProxyHost:o,cookieDomain:s,formOfWordsId:a,useConsentStore:i,disableFTCookies:r}))}),ye(u,e.baseEndpoint)}function T(e,t,n,o,s,a){const{text:i,onClick:u}=o[t],r=document.querySelectorAll(`a[href*="${a}"]`);for(const c of r)(n||e)&&(s.has(c)&&c.removeEventListener("click",s.get(c)),c.innerText=i,c.addEventListener("click",u),s.set(c,u))}function Ee({_clientOptions:e}=_){const{privacyManagerId:t,ccpaPrivacyManagerId:n,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=e??_._clientOptions,a={usnat:{text:"Do not sell my data",onClick:r=>{var c;r.preventDefault(),(c=window._sp_.usnat)==null||c.loadPrivacyManagerModal(o)}},ccpa:{text:"Do not sell my data",onClick:r=>{var c;r.preventDefault(),(c=window._sp_.ccpa)==null||c.loadPrivacyManagerModal(n)}},gdpr:{text:"Manage cookies",onClick:r=>{var c;r.preventDefault(),(c=window._sp_.gdpr)==null||c.loadPrivacyManagerModal(t)}}},i=new Map,u=function(r,c,f,y){console.log("handler called"),T(!1,r,y.applies,a,i,s),y.applies&&window._sp_queue.push(()=>{var N,L;(L=(N=window._sp_).removeEventListener)==null||L.call(N,"onConsentReady",u)})};T(!0,"gdpr",!1,a,i,s),window._sp_queue.push(()=>{var r,c;(c=(r=window._sp_).addEventListener)==null||c.call(r,"onConsentReady",u)})}function Oe(e,t){if(!t||Number.isFinite(parseFloat(t))||!e.endsWith(t))return!1;const n=e.indexOf(t),o=e[n-1];return o==="."||o===void 0}function Se(e){if(!e)throw new Error("Invalid hostname provided");let n=Object.values(z).find(o=>{var a;const s=(a=o._clientOptions)==null?void 0:a.rootDomain;return s&&Oe(e,s)});return n??(n=O),n}const ke=new URL(window.location.href).hostname,p=Se(ke);we({propertyConfig:p}),(M=p==null?void 0:p._clientOptions)!=null&&M.privacyManagerId&&((P=p==null?void 0:p._clientOptions)!=null&&P.manageCookiesLinkOverride)&&Ee(p)})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmp-manage-cookies-links.test.d.ts","sourceRoot":"","sources":["../../../../src/html/__tests__/cmp-manage-cookies-links.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { SPConfig } from "../../typings/types";
|
|
2
|
-
|
|
3
|
-
* Uses the `manageCookiesLinkOverride` property from SPConfig
|
|
4
|
-
* as a querySelectorALL to match anchor-tag elements by href attribute.
|
|
5
|
-
* Adds a "click" eventListener to the anchor-tag(s)
|
|
6
|
-
* prevents default and call Sourcepoint loadPrivacyManagerModal function.
|
|
7
|
-
|
|
8
|
-
* @returns Returns true if the link was updated, false if not
|
|
9
|
-
*/
|
|
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;
|
|
10
3
|
export declare function interceptManageCookiesLinks({ _clientOptions }?: SPConfig): void;
|
|
4
|
+
export declare const exportedForTesting: {
|
|
5
|
+
findAndUpdateLinks: typeof findAndUpdateLinks;
|
|
6
|
+
};
|
|
7
|
+
export {};
|
|
11
8
|
//# 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,
|
|
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,iBAAS,kBAAkB,CACzB,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;AAED,eAAO,MAAM,kBAAkB;;CAE9B,CAAC"}
|
|
@@ -16,7 +16,7 @@ export declare const iabCustomCategories: {
|
|
|
16
16
|
readonly specialFeatures: readonly [];
|
|
17
17
|
};
|
|
18
18
|
readonly demographicAds: {
|
|
19
|
-
readonly purposes: readonly [
|
|
19
|
+
readonly purposes: readonly [7, 9, 10];
|
|
20
20
|
readonly iabVendors: readonly [];
|
|
21
21
|
readonly customVendors: readonly [];
|
|
22
22
|
readonly specialFeatures: readonly [];
|
|
@@ -34,7 +34,7 @@ export declare const iabCustomCategories: {
|
|
|
34
34
|
readonly specialFeatures: readonly [];
|
|
35
35
|
};
|
|
36
36
|
readonly personalisedMarketing: {
|
|
37
|
-
readonly purposes: readonly [
|
|
37
|
+
readonly purposes: readonly [2, 7, 8, 9, 10];
|
|
38
38
|
readonly iabVendors: readonly [];
|
|
39
39
|
readonly customVendors: readonly [];
|
|
40
40
|
readonly specialFeatures: readonly [];
|
|
@@ -21,6 +21,8 @@ export declare const FT_DOTCOM_PROD: {
|
|
|
21
21
|
propertyId: number;
|
|
22
22
|
_clientOptions: {
|
|
23
23
|
privacyManagerId: number;
|
|
24
|
+
usnatPrivacyManagerId: number;
|
|
25
|
+
ccpaPrivacyManagerId: number;
|
|
24
26
|
manageCookiesLinkOverride: string;
|
|
25
27
|
rootDomain: string;
|
|
26
28
|
};
|
|
@@ -127,4 +129,15 @@ export declare const MM_IGNITES_EUROPE: {
|
|
|
127
129
|
gdpr: {};
|
|
128
130
|
ccpa: {};
|
|
129
131
|
};
|
|
132
|
+
export declare const SP_MANDATE_WIRE: {
|
|
133
|
+
accountId: number;
|
|
134
|
+
baseEndpoint: string;
|
|
135
|
+
propertyId: number;
|
|
136
|
+
_clientOptions: {
|
|
137
|
+
rootDomain: string;
|
|
138
|
+
};
|
|
139
|
+
joinHref: boolean;
|
|
140
|
+
gdpr: {};
|
|
141
|
+
ccpa: {};
|
|
142
|
+
};
|
|
130
143
|
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/lib/properties.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAS1B,CAAC;AAEF,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/lib/properties.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAS1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;CAY1B,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"}
|
package/dist/src/utils/url.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export declare function getPropertyConfigByHostname(hostname: string): {
|
|
|
26
26
|
propertyId: number;
|
|
27
27
|
_clientOptions: {
|
|
28
28
|
privacyManagerId: number;
|
|
29
|
+
usnatPrivacyManagerId: number;
|
|
30
|
+
ccpaPrivacyManagerId: number;
|
|
29
31
|
manageCookiesLinkOverride: string;
|
|
30
32
|
rootDomain: string;
|
|
31
33
|
};
|
|
@@ -122,5 +124,15 @@ export declare function getPropertyConfigByHostname(hostname: string): {
|
|
|
122
124
|
joinHref: boolean;
|
|
123
125
|
gdpr: {};
|
|
124
126
|
ccpa: {};
|
|
127
|
+
} | {
|
|
128
|
+
accountId: number;
|
|
129
|
+
baseEndpoint: string;
|
|
130
|
+
propertyId: number;
|
|
131
|
+
_clientOptions: {
|
|
132
|
+
rootDomain: string;
|
|
133
|
+
};
|
|
134
|
+
joinHref: boolean;
|
|
135
|
+
gdpr: {};
|
|
136
|
+
ccpa: {};
|
|
125
137
|
};
|
|
126
138
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa3D"}
|
package/package.json
CHANGED
package/typings/globals.d.ts
CHANGED
|
@@ -8,7 +8,10 @@ declare global {
|
|
|
8
8
|
_sp_: {
|
|
9
9
|
config: SPConfig;
|
|
10
10
|
addEventListener?: (e: string, callback: SPEventCallback) => void;
|
|
11
|
+
removeEventListener?: (e: string, callback: SPEventCallback) => void;
|
|
11
12
|
gdpr?: { loadPrivacyManagerModal: (id: number | undefined) => void };
|
|
13
|
+
ccpa?: { loadPrivacyManagerModal: (id: number | undefined) => void };
|
|
14
|
+
usnat?: { loadPrivacyManagerModal: (id: number | undefined) => void };
|
|
12
15
|
};
|
|
13
16
|
_sp_queue: (() => void)[];
|
|
14
17
|
__tcfapi: (key: string, n: number, callback: (resp: TCData) => void) => void;
|
package/typings/types.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export type SPEventId = keyof SPLifecycleEvents;
|
|
|
8
8
|
|
|
9
9
|
export type SPConfigClientOptions = {
|
|
10
10
|
privacyManagerId?: number;
|
|
11
|
+
usnatPrivacyManagerId?: number;
|
|
12
|
+
ccpaPrivacyManagerId?: number;
|
|
11
13
|
manageCookiesLinkOverride?: string;
|
|
12
14
|
rootDomain?: string;
|
|
13
15
|
};
|
|
@@ -17,6 +19,7 @@ export interface SPConfig {
|
|
|
17
19
|
baseEndpoint: string;
|
|
18
20
|
gdpr: Record<string, unknown>;
|
|
19
21
|
ccpa: Record<string, unknown>;
|
|
22
|
+
usnat?: Record<string, unknown>;
|
|
20
23
|
propertyHref?: string;
|
|
21
24
|
propertyId?: number;
|
|
22
25
|
joinHref?: boolean;
|
|
@@ -185,3 +188,16 @@ export type TCData = {
|
|
|
185
188
|
restrictions: Record<string, Record<string, 0 | 1 | 2>>;
|
|
186
189
|
};
|
|
187
190
|
};
|
|
191
|
+
|
|
192
|
+
export interface LinkOnClickFunction {
|
|
193
|
+
(e: MouseEvent): void;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface PrivacyManagerRegionId {
|
|
197
|
+
text: string;
|
|
198
|
+
onClick: LinkOnClickFunction;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface regionConfig {
|
|
202
|
+
[key: string]: PrivacyManagerRegionId;
|
|
203
|
+
}
|