@financial-times/cmp-client 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +228 -77
- package/dist/index.js +228 -77
- package/dist/scripts/cmp-static.js +2 -1
- package/dist/src/client.d.ts +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/consent-parsers/__fixtures__/gpp.d.ts +20 -0
- package/dist/src/consent-parsers/__fixtures__/gpp.d.ts.map +1 -0
- package/dist/src/consent-parsers/__tests__/index.test.d.ts +2 -0
- package/dist/src/consent-parsers/__tests__/index.test.d.ts.map +1 -0
- package/dist/src/consent-parsers/gpp/__tests__/parse-gpp-consent.test.d.ts +2 -0
- package/dist/src/consent-parsers/gpp/__tests__/parse-gpp-consent.test.d.ts.map +1 -0
- package/dist/src/consent-parsers/gpp/index.d.ts +3 -0
- package/dist/src/consent-parsers/gpp/index.d.ts.map +1 -0
- package/dist/src/consent-parsers/index.d.ts +6 -0
- package/dist/src/consent-parsers/index.d.ts.map +1 -0
- package/dist/src/consent-parsers/tcfv2/__tests__/check-consent.test.d.ts.map +1 -0
- package/dist/src/{consent-ready/utils/get-parsed-consent.d.ts → consent-parsers/tcfv2/index.d.ts} +2 -7
- package/dist/src/consent-parsers/tcfv2/index.d.ts.map +1 -0
- package/dist/src/consent-ready/index.d.ts.map +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/html/cmp-scripts.d.ts +2 -2
- package/dist/src/html/cmp-scripts.d.ts.map +1 -1
- package/dist/src/lib/configurators/ft-dot-com.d.ts +7 -0
- package/dist/src/lib/configurators/ft-dot-com.d.ts.map +1 -0
- package/dist/src/lib/configurators/index.d.ts +14 -0
- package/dist/src/lib/configurators/index.d.ts.map +1 -0
- package/dist/src/lib/constants.d.ts +0 -4
- package/dist/src/lib/constants.d.ts.map +1 -1
- package/dist/src/lib/properties.d.ts +3 -12
- package/dist/src/lib/properties.d.ts.map +1 -1
- package/dist/src/utils/url.d.ts +3 -12
- package/dist/src/utils/url.d.ts.map +1 -1
- package/package.json +1 -1
- package/typings/globals.d.ts +5 -1
- package/typings/types.d.ts +97 -4
- package/dist/src/consent-ready/utils/__tests__/check-consent.test.d.ts.map +0 -1
- package/dist/src/consent-ready/utils/__tests__/get-parsed-consent.test.d.ts +0 -2
- package/dist/src/consent-ready/utils/__tests__/get-parsed-consent.test.d.ts.map +0 -1
- package/dist/src/consent-ready/utils/get-parsed-consent.d.ts.map +0 -1
- /package/dist/src/{consent-ready/utils → consent-parsers/tcfv2}/__tests__/check-consent.test.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -44,8 +44,7 @@ const debug = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
44
44
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
45
45
|
const defaults = {
|
|
46
46
|
joinHref: true,
|
|
47
|
-
gdpr: {}
|
|
48
|
-
ccpa: {}
|
|
47
|
+
gdpr: {}
|
|
49
48
|
};
|
|
50
49
|
const FT_DOTCOM_TEST = {
|
|
51
50
|
...defaults,
|
|
@@ -54,7 +53,8 @@ const FT_DOTCOM_TEST = {
|
|
|
54
53
|
propertyHref: "https://local.ft.com",
|
|
55
54
|
_clientOptions: {
|
|
56
55
|
privacyManagerId: 827767,
|
|
57
|
-
manageCookiesLinkOverride: "ft.com/preferences/manage-cookies"
|
|
56
|
+
manageCookiesLinkOverride: "ft.com/preferences/manage-cookies",
|
|
57
|
+
rootDomain: "ft.com"
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
const FT_DOTCOM_PROD = {
|
|
@@ -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
|
}
|
|
@@ -173,40 +175,75 @@ const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
173
175
|
SP_SUSTAINABLE_VIEWS,
|
|
174
176
|
SP_THE_BANKER
|
|
175
177
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return resolve();
|
|
179
|
-
const isReady = () => ["interactive", "complete"].includes(document.readyState);
|
|
180
|
-
function onStateChange() {
|
|
181
|
-
if (isReady()) {
|
|
182
|
-
document.removeEventListener("readystatechange", onStateChange);
|
|
183
|
-
resolve();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (isReady())
|
|
187
|
-
return resolve();
|
|
188
|
-
document.addEventListener("readystatechange", onStateChange);
|
|
189
|
-
});
|
|
190
|
-
function findAndUpdateLinks(_clientOptions, loadPrivacyManagerModal) {
|
|
191
|
-
const { privacyManagerId, manageCookiesLinkOverride } = _clientOptions ?? {};
|
|
192
|
-
if (!privacyManagerId || !manageCookiesLinkOverride) {
|
|
193
|
-
return console.warn("_clientOptions is missing privacyManagerId or manageCookiesLinkOverride");
|
|
194
|
-
}
|
|
178
|
+
function findAndUpdateLinks(fallback, regionId, regionApplies, regionConfig, linkMap, manageCookiesLinkOverride) {
|
|
179
|
+
const { text, onClick } = regionConfig[regionId];
|
|
195
180
|
const anchors = document.querySelectorAll(`a[href*="${manageCookiesLinkOverride}"]`);
|
|
196
181
|
for (const anchor of anchors) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
+
}
|
|
201
190
|
}
|
|
202
191
|
}
|
|
203
192
|
function interceptManageCookiesLinks({ _clientOptions } = FT_DOTCOM_PROD) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
+
findAndUpdateLinks(
|
|
228
|
+
false,
|
|
229
|
+
message_type,
|
|
230
|
+
info.applies,
|
|
231
|
+
regionConfig,
|
|
232
|
+
linkMap,
|
|
233
|
+
manageCookiesLinkOverride
|
|
234
|
+
);
|
|
235
|
+
if (info.applies) {
|
|
236
|
+
window._sp_queue.push(() => {
|
|
237
|
+
var _a, _b;
|
|
238
|
+
(_b = (_a = window._sp_).removeEventListener) == null ? void 0 : _b.call(_a, "onConsentReady", onConsentReadyHandler);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
findAndUpdateLinks(true, "gdpr", false, regionConfig, linkMap, manageCookiesLinkOverride);
|
|
243
|
+
window._sp_queue ?? (window._sp_queue = []);
|
|
244
|
+
window._sp_queue.push(() => {
|
|
245
|
+
var _a, _b;
|
|
246
|
+
(_b = (_a = window._sp_).addEventListener) == null ? void 0 : _b.call(_a, "onConsentReady", onConsentReadyHandler);
|
|
210
247
|
});
|
|
211
248
|
}
|
|
212
249
|
const request = (url, { credentials = "omit" } = {}) => {
|
|
@@ -334,20 +371,34 @@ const scriptSources = {
|
|
|
334
371
|
};
|
|
335
372
|
const scriptContent = {
|
|
336
373
|
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()}();`,
|
|
337
|
-
|
|
374
|
+
gppStub: `window.__gpp_addFrame=function(e){if(!window.frames[e])if(document.body){var t=document.createElement("iframe");t.style.cssText="display:none",t.name=e,document.body.appendChild(t)}else window.setTimeout(window.__gpp_addFrame,10,e)},window.__gpp_stub=function(){var e=arguments;if(__gpp.queue=__gpp.queue||[],__gpp.events=__gpp.events||[],!e.length||1==e.length&&"queue"==e[0])return __gpp.queue;if(1==e.length&&"events"==e[0])return __gpp.events;var t=e[0],p=e.length>1?e[1]:null,s=e.length>2?e[2]:null;if("ping"===t)p({gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}},!0);else if("addEventListener"===t){"lastId"in __gpp||(__gpp.lastId=0),__gpp.lastId++;var n=__gpp.lastId;__gpp.events.push({id:n,callback:p,parameter:s}),p({eventName:"listenerRegistered",listenerId:n,data:!0,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else if("removeEventListener"===t){for(var a=!1,i=0;i<__gpp.events.length;i++)if(__gpp.events[i].id==s){__gpp.events.splice(i,1),a=!0;break}p({eventName:"listenerRemoved",listenerId:s,data:a,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else"hasSection"===t?p(!1,!0):"getSection"===t||"getField"===t?p(null,!0):__gpp.queue.push([].slice.apply(e))},window.__gpp_msghandler=function(e){var t="string"==typeof e.data;try{var p=t?JSON.parse(e.data):e.data}catch(e){p=null}if("object"==typeof p&&null!==p&&"__gppCall"in p){var s=p.__gppCall;window.__gpp(s.command,(function(p,n){var a={__gppReturn:{returnValue:p,success:n,callId:s.callId}};e.source.postMessage(t?JSON.stringify(a):a,"*")}),"parameter"in s?s.parameter:null,"version"in s?s.version:"1.1")}},"__gpp"in window&&"function"==typeof window.__gpp||(window.__gpp=window.__gpp_stub,window.addEventListener("message",window.__gpp_msghandler,!1),window.__gpp_addFrame("__gppLocator"));
|
|
375
|
+
`
|
|
338
376
|
};
|
|
339
|
-
function getCmpScripts() {
|
|
377
|
+
function getCmpScripts(options) {
|
|
340
378
|
const fragment = document.createDocumentFragment();
|
|
341
379
|
fragment.appendChild(createContentScript("tcf", scriptContent.tcfStub));
|
|
342
|
-
|
|
380
|
+
if (options.includeUsNat) {
|
|
381
|
+
fragment.appendChild(createContentScript("gpp", scriptContent.gppStub));
|
|
382
|
+
}
|
|
343
383
|
fragment.appendChild(createSourceScript(scriptSources.cmpFrames));
|
|
344
384
|
return fragment;
|
|
345
385
|
}
|
|
346
|
-
function
|
|
386
|
+
function applyOptionsToConfig(propertyConfig, options) {
|
|
387
|
+
const { userId, includeUsNat } = options;
|
|
388
|
+
if (userId) {
|
|
389
|
+
propertyConfig.authId = userId;
|
|
390
|
+
}
|
|
391
|
+
if (includeUsNat) {
|
|
392
|
+
propertyConfig.usnat = propertyConfig.usnat || {};
|
|
393
|
+
}
|
|
394
|
+
return propertyConfig;
|
|
395
|
+
}
|
|
396
|
+
function bootstrapCmp(config, options) {
|
|
347
397
|
const { _clientOptions, ...spConfig } = config;
|
|
348
|
-
|
|
398
|
+
const runtimeConfig = applyOptionsToConfig(spConfig, options);
|
|
399
|
+
window._sp_ = { config: runtimeConfig };
|
|
349
400
|
window._sp_queue ?? (window._sp_queue = []);
|
|
350
|
-
document.head.appendChild(getCmpScripts());
|
|
401
|
+
document.head.appendChild(getCmpScripts(options));
|
|
351
402
|
}
|
|
352
403
|
function getConsentPayload(parsedConsent, updateConsentStore, { formOfWordsId, cookieDomain }) {
|
|
353
404
|
const categoryNames = Object.keys(parsedConsent);
|
|
@@ -376,6 +427,89 @@ function getConsentPayload(parsedConsent, updateConsentStore, { formOfWordsId, c
|
|
|
376
427
|
}
|
|
377
428
|
return { data, cookieDomain };
|
|
378
429
|
}
|
|
430
|
+
const sections = {
|
|
431
|
+
CALIFORNIA: "uscav1",
|
|
432
|
+
US_NATIONAL: "usnatv1"
|
|
433
|
+
};
|
|
434
|
+
const sectionConfig = {
|
|
435
|
+
[sections.CALIFORNIA]: {
|
|
436
|
+
excludedCategories: {
|
|
437
|
+
personalisedMarketing: true
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
[sections.US_NATIONAL]: {
|
|
441
|
+
excludedCategories: {
|
|
442
|
+
personalisedMarketing: true
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
function getApplicableSection(gppData) {
|
|
447
|
+
const { applicableSections, supportedAPIs } = gppData;
|
|
448
|
+
const applicableSection = applicableSections[0];
|
|
449
|
+
if (applicableSection === -1 || typeof applicableSection === "undefined") {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const sectionApi = supportedAPIs.find((api) => api.startsWith(`${applicableSection}:`));
|
|
453
|
+
const sectionKey = sectionApi == null ? void 0 : sectionApi.split(":")[1];
|
|
454
|
+
return sectionKey;
|
|
455
|
+
}
|
|
456
|
+
function parseCaliforniaSection(sectionData) {
|
|
457
|
+
const { SaleOptOut, SharingOptOut, Gpc } = sectionData;
|
|
458
|
+
const { excludedCategories } = sectionConfig[sections.CALIFORNIA];
|
|
459
|
+
const userHasNotOptedOut = SaleOptOut !== 1 && SharingOptOut !== 1 && !Gpc;
|
|
460
|
+
const parsedConsent = {};
|
|
461
|
+
for (const categoryName of iabCategoryNames) {
|
|
462
|
+
if (categoryName in excludedCategories) {
|
|
463
|
+
parsedConsent[categoryName] = true;
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
parsedConsent[categoryName] = userHasNotOptedOut;
|
|
467
|
+
}
|
|
468
|
+
return parsedConsent;
|
|
469
|
+
}
|
|
470
|
+
function parseUsNationalSection(sectionData) {
|
|
471
|
+
const { SaleOptOut, SharingOptOut, TargetedAdvertisingOptOut } = sectionData;
|
|
472
|
+
const { excludedCategories } = sectionConfig[sections.US_NATIONAL];
|
|
473
|
+
const userHasNotOptedOut = SaleOptOut !== 1 && SharingOptOut !== 1 && TargetedAdvertisingOptOut !== 1;
|
|
474
|
+
const parsedConsent = {};
|
|
475
|
+
for (const categoryName of iabCategoryNames) {
|
|
476
|
+
if (categoryName in excludedCategories) {
|
|
477
|
+
parsedConsent[categoryName] = true;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
parsedConsent[categoryName] = userHasNotOptedOut;
|
|
481
|
+
}
|
|
482
|
+
return parsedConsent;
|
|
483
|
+
}
|
|
484
|
+
const sectionParsers = {
|
|
485
|
+
[sections.CALIFORNIA]: parseCaliforniaSection,
|
|
486
|
+
[sections.US_NATIONAL]: parseUsNationalSection
|
|
487
|
+
};
|
|
488
|
+
async function parseGPPConsent() {
|
|
489
|
+
const gppData = await new Promise((resolve, reject) => {
|
|
490
|
+
try {
|
|
491
|
+
if (window.__gpp) {
|
|
492
|
+
window.__gpp("ping", resolve);
|
|
493
|
+
} else {
|
|
494
|
+
reject(new Error("GPP API is not available on page"));
|
|
495
|
+
}
|
|
496
|
+
} catch (error) {
|
|
497
|
+
reject(error);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
const { parsedSections } = gppData;
|
|
501
|
+
const applicableSection = getApplicableSection(gppData);
|
|
502
|
+
if (!applicableSection || !parsedSections[applicableSection]) {
|
|
503
|
+
throw new Error("GPP parser was called without an applicable section");
|
|
504
|
+
}
|
|
505
|
+
const sectionData = parsedSections[applicableSection];
|
|
506
|
+
const parseSection = sectionParsers[applicableSection];
|
|
507
|
+
if (!parseSection || typeof parseSection !== "function") {
|
|
508
|
+
throw new Error(`No parser found for applicable GPP section: ${applicableSection}`);
|
|
509
|
+
}
|
|
510
|
+
const parsedConsent = parseSection(sectionData);
|
|
511
|
+
return parsedConsent;
|
|
512
|
+
}
|
|
379
513
|
function checkConsentFor(categoryName, { purpose, vendor, specialFeatureOptins }) {
|
|
380
514
|
const customCategory = iabCustomCategories[categoryName];
|
|
381
515
|
const requiredPurposesConsented = customCategory.purposes.every(
|
|
@@ -389,19 +523,14 @@ function checkConsentFor(categoryName, { purpose, vendor, specialFeatureOptins }
|
|
|
389
523
|
);
|
|
390
524
|
return requiredPurposesConsented && requiredIabVendorsConsented && requiredSpecialFeaturesConsented;
|
|
391
525
|
}
|
|
392
|
-
function parseCCPAConsent(ccpa) {
|
|
393
|
-
const userHasNotOptedOut = (ccpa == null ? void 0 : ccpa[2]) === "N";
|
|
394
|
-
const parsedConsent = {};
|
|
395
|
-
for (const categoryName of iabCategoryNames) {
|
|
396
|
-
parsedConsent[categoryName] = userHasNotOptedOut;
|
|
397
|
-
}
|
|
398
|
-
return parsedConsent;
|
|
399
|
-
}
|
|
400
526
|
async function parseGDPRConsent() {
|
|
401
527
|
const tcData = await new Promise((resolve, reject) => {
|
|
402
|
-
var _a;
|
|
403
528
|
try {
|
|
404
|
-
(
|
|
529
|
+
if (window.__tcfapi) {
|
|
530
|
+
window.__tcfapi("addEventListener", 2, resolve);
|
|
531
|
+
} else {
|
|
532
|
+
reject(new Error("TCF API is not available on page"));
|
|
533
|
+
}
|
|
405
534
|
} catch (error) {
|
|
406
535
|
reject(error);
|
|
407
536
|
}
|
|
@@ -412,8 +541,16 @@ async function parseGDPRConsent() {
|
|
|
412
541
|
}
|
|
413
542
|
return parsedConsent;
|
|
414
543
|
}
|
|
415
|
-
async function getParsedConsent(activeLegislation
|
|
416
|
-
|
|
544
|
+
async function getParsedConsent(activeLegislation) {
|
|
545
|
+
const legislationParsers = {
|
|
546
|
+
gdpr: parseGDPRConsent,
|
|
547
|
+
usnat: parseGPPConsent
|
|
548
|
+
};
|
|
549
|
+
const consentParser = legislationParsers[activeLegislation];
|
|
550
|
+
if (!consentParser) {
|
|
551
|
+
throw new Error("Unable to update user consent. Unsupported consent legislation.");
|
|
552
|
+
}
|
|
553
|
+
return consentParser();
|
|
417
554
|
}
|
|
418
555
|
function getConsentCookieValue() {
|
|
419
556
|
const cookies = Object.fromEntries(
|
|
@@ -469,11 +606,22 @@ function consentReadyHandlerFn(props) {
|
|
|
469
606
|
if (props.disableFTCookies) {
|
|
470
607
|
return;
|
|
471
608
|
}
|
|
609
|
+
if (!props.includeUsNat && legislation === "usnat") {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
472
612
|
const activeLegislation = consentMeta.applies ? legislation : "gdpr";
|
|
473
613
|
if (activeLegislation !== legislation || !consentString) {
|
|
474
614
|
return;
|
|
475
615
|
}
|
|
476
|
-
|
|
616
|
+
let parsedConsent;
|
|
617
|
+
try {
|
|
618
|
+
parsedConsent = await getParsedConsent(activeLegislation);
|
|
619
|
+
} catch (error) {
|
|
620
|
+
console.error(error);
|
|
621
|
+
}
|
|
622
|
+
if (!parsedConsent) {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
477
625
|
const consentHasChanged = hasConsentChanged(parsedConsent, getConsentCookieValue());
|
|
478
626
|
if (!consentHasChanged) {
|
|
479
627
|
return;
|
|
@@ -648,18 +796,19 @@ function setupPmTracking(trackingProps, cmpBaseEndpoint) {
|
|
|
648
796
|
false
|
|
649
797
|
);
|
|
650
798
|
}
|
|
651
|
-
const version = "
|
|
652
|
-
async function initSourcepointCmp({
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
} = {}
|
|
799
|
+
const version = "5.0.0";
|
|
800
|
+
async function initSourcepointCmp(options) {
|
|
801
|
+
const {
|
|
802
|
+
useFTSession = true,
|
|
803
|
+
consentProxyHost = FT_CONSENT_PROXY_HOST,
|
|
804
|
+
cookieDomain = FT_COOKIE_DOMAIN,
|
|
805
|
+
formOfWordsId = SOURCEPOINT_FOW_ID,
|
|
806
|
+
useConsentStore = true,
|
|
807
|
+
trackingContext = {},
|
|
808
|
+
disableFTCookies = false,
|
|
809
|
+
includeUsNat = false
|
|
810
|
+
} = options || {};
|
|
811
|
+
let { propertyConfig = FT_DOTCOM_PROD, userId } = options || {};
|
|
663
812
|
if (typeof window === "undefined") {
|
|
664
813
|
console.error("The CMP client can only be initialised in a browser context");
|
|
665
814
|
return;
|
|
@@ -673,19 +822,8 @@ async function initSourcepointCmp({
|
|
|
673
822
|
console.error(error);
|
|
674
823
|
}
|
|
675
824
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
}
|
|
679
|
-
if (userId) {
|
|
680
|
-
propertyConfig.authId = userId;
|
|
681
|
-
}
|
|
682
|
-
if (propertyConfig.events) {
|
|
683
|
-
console.warn(
|
|
684
|
-
"[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"
|
|
685
|
-
);
|
|
686
|
-
delete propertyConfig.events;
|
|
687
|
-
}
|
|
688
|
-
bootstrapCmp(propertyConfig);
|
|
825
|
+
propertyConfig = validateAndCleanConfig(propertyConfig);
|
|
826
|
+
bootstrapCmp(propertyConfig, { userId, includeUsNat });
|
|
689
827
|
window._sp_queue.push(() => {
|
|
690
828
|
var _a, _b;
|
|
691
829
|
(_b = (_a = window._sp_) == null ? void 0 : _a.addEventListener) == null ? void 0 : _b.call(
|
|
@@ -697,12 +835,25 @@ async function initSourcepointCmp({
|
|
|
697
835
|
cookieDomain,
|
|
698
836
|
formOfWordsId,
|
|
699
837
|
useConsentStore,
|
|
700
|
-
disableFTCookies
|
|
838
|
+
disableFTCookies,
|
|
839
|
+
includeUsNat
|
|
701
840
|
})
|
|
702
841
|
);
|
|
703
842
|
});
|
|
704
843
|
initTracking(trackingContext, propertyConfig.baseEndpoint);
|
|
705
844
|
}
|
|
845
|
+
function validateAndCleanConfig(propertyConfig) {
|
|
846
|
+
if (!(propertyConfig == null ? void 0 : propertyConfig.accountId)) {
|
|
847
|
+
throw new Error("Please pass a valid property config");
|
|
848
|
+
}
|
|
849
|
+
if (propertyConfig.events) {
|
|
850
|
+
console.warn(
|
|
851
|
+
"[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"
|
|
852
|
+
);
|
|
853
|
+
delete propertyConfig.events;
|
|
854
|
+
}
|
|
855
|
+
return propertyConfig;
|
|
856
|
+
}
|
|
706
857
|
export {
|
|
707
858
|
debug,
|
|
708
859
|
initSourcepointCmp,
|
|
@@ -1 +1,2 @@
|
|
|
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={},P=()=>{const[,e]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return e},L=()=>{const e=g("uuid");if(e)return Promise.resolve({uuid:e});const t=P();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})},I="sourcepoint-cmp",M="FTPINK",A="FTConsent",D="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",R=".ft.com",F="https://consent.ft.com",v={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(v),i={joinHref:!0,gdpr:{},ccpa:{}},w={...i,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyHref:"https://local.ft.com",_clientOptions:{privacyManagerId:827767,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies"}},y={...i,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyId:31642,_clientOptions:{privacyManagerId:827767,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies",rootDomain:"ft.com"}},V={...i,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com"}},j={...i,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com"}},H={...i,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com"}},U={...i,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com"}},x={...i,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com"}},q={...i,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com"}},$={...i,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk"}},G={...i,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},W={...i,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},K={...i,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com"}},B=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:y,FT_DOTCOM_TEST:w,MM_IGNITES_ASIA:G,MM_IGNITES_EUROPE:W,SP_BANKING_RR:U,SP_FDI_INTELLIGENCE:j,SP_FT_ADVISER:q,SP_INVESTORS_CHRONICLE:$,SP_MANDATE_WIRE:K,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 J(e){const t=document.createElement("script");return t.src=e,t}const X={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 Y(){const e=document.createDocumentFragment();return e.appendChild(O("tcf",S.tcfStub)),e.appendChild(O("usp",S.uspStub)),e.appendChild(J(X.cmpFrames)),e}function z(e){const{_clientOptions:t,...n}=e;window._sp_={config:n},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(Y())}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:I,fow:n}},r),{});return t?{setConsentCookie:!0,formOfWordsId:n,consentSource:I,cookieDomain:o,data:c}:{data:c,cookieDomain:o}}function Q(e,{purpose:t,vendor:n,specialFeatureOptins:o}){const s=v[e],c=s.purposes.every(u=>(t==null?void 0:t.consents[u])||(t==null?void 0:t.legitimateInterests[u])),r=s.iabVendors.every(u=>(n==null?void 0:n.consents[u])||(n==null?void 0:n.legitimateInterests[u])),p=s.specialFeatures.every(u=>(o==null?void 0:o[u])===!0);return c&&r&&p}function ee(e){const t=(e==null?void 0:e[2])==="N",n={};for(const o of E)n[o]=t;return n}async function te(){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]=Q(n,e);return t}async function ne(e,t){return e==="ccpa"?ee(t):await te()}function oe(){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 se(e,t){return Object.keys(e).some(o=>{const s=`${o.toLowerCase()}Onsite`;return e[o]!==t[s]})}function ce({userId:e,useConsentStore:t}){return!!e&&t===!0}function re(e,t){return e?`${t.consentProxyHost}/__consent/consent-record/${M}/${t.userId}`:`${t.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${t.cookieDomain}`}async function ae(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 ie(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 ne(r,s);if(!se(p,oe()))return;const a=ce(e),_=re(a,e),Se=Z(p,a,e);await ae(_,Se),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const b="cookie-message",ue="manage-cookies";let h=Object.freeze({activeComponent:b,messageId:0,privacyManagerId:0});function pe(e){return typeof e=="object"&&e!==null&&e.constructor===Object&&Object.prototype.toString.call(e)==="[object Object]"}const de=()=>({...h}),C=e=>{if(!pe(e)){console.error("Invalid state changes");return}h={...h,...e}},le=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function fe(e,t){const n=me(e.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[c,r]of Object.entries(ge))(s=(o=window._sp_).addEventListener)==null||s.call(o,c,r({...e,flags:n}))}),ye({...e,flags:n},t)}function me(e){const t={};return typeof e=="object"&&le.forEach(n=>{Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}),t}function _e(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=de(),{product:c,app:r,flags:p}=e;s.activeComponent===b?o=s.messageId:o=s.privacyManagerId;const u={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}};_e(u)}const ge={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 ye(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:ue,privacyManagerId:+r}),!(!c||!o[c])&&m({trackingProps:e,action:"click",triggerAction:o[c]}))},!1)}const be="4.1.0";async function he({propertyConfig:e=y,userId:t,useFTSession:n=!0,consentProxyHost:o=F,cookieDomain:s=R,formOfWordsId:c=D,useConsentStore:r=!0,trackingContext:p={},disableFTCookies:u=!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=be,!t&&n)try{const a=await L();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),z(e),window._sp_queue.push(()=>{var a,_;(_=(a=window._sp_)==null?void 0:a.addEventListener)==null||_.call(a,"onConsentReady",ie({userId:t,consentProxyHost:o,cookieDomain:s,formOfWordsId:c,useConsentStore:r,disableFTCookies:u}))}),fe(p,e.baseEndpoint)}const Ce=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 Ie(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){Ce.then(()=>{window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var t,n;Ie(e,(n=(t=window._sp_)==null?void 0:t.gdpr)==null?void 0:n.loadPrivacyManagerModal)})})}function Ee(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 we(e){if(!e)throw new Error("Invalid hostname provided");let n=Object.values(B).find(o=>{var c;const s=(c=o._clientOptions)==null?void 0:c.rootDomain;return s&&Ee(e,s)});return n??(n=w),n}const Oe=new URL(window.location.href).hostname,d=we(Oe);he({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,L;const R=(e,{credentials:n="omit"}={})=>fetch(`https://session-next.ft.com${e}`,{credentials:n,useCorsProxy:!0}).then(t=>t.ok?t.json():t.text().then(o=>{throw new Error(`Next session responded with "${o}" (${t.status})`)})).catch(t=>{document.body.dispatchEvent(new CustomEvent("oErrors.log",{bubbles:!0,detail:{error:t,info:{component:"next-session-client"}}}))});let _={};const I=(e,n)=>{if(typeof e=="object"){_=e;return}if(typeof e=="string"&&typeof n=="string"){_[e]=n;return}if(typeof e=="string"&&typeof n>"u")return _[e]||null;if(typeof e>"u"&&typeof n>"u")return _;throw new Error("Invalid arguments")};I.clear=()=>{_={}};const v={},F=()=>{const[,e]=/FTSession_s=([^;]+)/.exec(document.cookie)||[];return e},U=()=>{const e=I("uuid");if(e)return Promise.resolve({uuid:e});const n=F();return n?(v.uuid||(v.uuid=R(`/sessions/s/${n}`).then(({uuid:t}={})=>(delete v.uuid,t&&I("uuid",t),{uuid:t}))),v.uuid):Promise.resolve({uuid:void 0})},O="sourcepoint-cmp",V="FTPINK",x="FTConsent",j="sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk",H=".ft.com",q="https://consent.ft.com",E={permutiveAds:{purposes:[2,4,8,9],iabVendors:[361],customVendors:[],specialFeatures:[]},demographicAds:{purposes:[7,9,10],iabVendors:[],customVendors:[],specialFeatures:[]},behaviouralAds:{purposes:[2,4,8,9],iabVendors:[],customVendors:[],specialFeatures:[]},programmaticAds:{purposes:[2],iabVendors:[],customVendors:[],specialFeatures:[]},personalisedMarketing:{purposes:[2,7,8,9,10],iabVendors:[],customVendors:[],specialFeatures:[]}},C=Object.keys(E),d={joinHref:!0,gdpr:{}},T={...d,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyHref:"https://local.ft.com",_clientOptions:{privacyManagerId:827767,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies",rootDomain:"ft.com"}},y={...d,accountId:1906,baseEndpoint:"https://consent-manager.ft.com",propertyId:31642,_clientOptions:{privacyManagerId:827767,usnatPrivacyManagerId:944881,ccpaPrivacyManagerId:944882,manageCookiesLinkOverride:"ft.com/preferences/manage-cookies",rootDomain:"ft.com"}},G={...d,accountId:1906,baseEndpoint:"https://consent-manager.pwmnet.com",propertyId:33414,_clientOptions:{rootDomain:"pwmnet.com"}},$={...d,accountId:1906,baseEndpoint:"https://consent-manager.fdiintelligence.com",propertyId:34061,_clientOptions:{rootDomain:"fdiintelligence.com"}},W={...d,accountId:1906,baseEndpoint:"https://consent-manager.thebanker.com",propertyId:34060,_clientOptions:{rootDomain:"thebanker.com"}},K={...d,accountId:1906,baseEndpoint:"https://consent-manager.bankingriskandregulation.com",propertyId:34059,_clientOptions:{rootDomain:"bankingriskandregulation.com"}},J={...d,accountId:1906,baseEndpoint:"https://consent-manager.sustainableviews.com",propertyId:34058,_clientOptions:{rootDomain:"sustainableviews.com"}},B={...d,accountId:1906,baseEndpoint:"https://consent-manager.ftadviser.com",propertyId:33416,_clientOptions:{rootDomain:"ftadviser.com"}},X={...d,accountId:1906,baseEndpoint:"https://consent-manager.investorschronicle.co.uk",propertyId:33415,_clientOptions:{rootDomain:"investorschronicle.co.uk"}},Y={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33947,_clientOptions:{rootDomain:"ignitesasia.com"}},z={...d,accountId:1906,baseEndpoint:"https://cdn.privacy-mgmt.com",propertyId:33946,_clientOptions:{rootDomain:"igniteseurope.com"}},Z={...d,accountId:1906,baseEndpoint:"https://consent-manager.mandatewire.com",propertyId:35490,_clientOptions:{rootDomain:"mandatewire.com"}},Q=Object.freeze(Object.defineProperty({__proto__:null,FT_DOTCOM_PROD:y,FT_DOTCOM_TEST:T,MM_IGNITES_ASIA:Y,MM_IGNITES_EUROPE:z,SP_BANKING_RR:K,SP_FDI_INTELLIGENCE:$,SP_FT_ADVISER:B,SP_INVESTORS_CHRONICLE:X,SP_MANDATE_WIRE:Z,SP_PWMNET:G,SP_SUSTAINABLE_VIEWS:J,SP_THE_BANKER:W},Symbol.toStringTag,{value:"Module"}));function k(e,n){const t=document.createElement("script");return t.dataset.cmpScript=e,t.innerHTML=n,t}function ee(e){const n=document.createElement("script");return n.src=e,n}const te={cmpFrames:"https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"},N={tcfStub:'"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){var t=function(){var t,e,o=[],n=window,r=n;for(;r;){try{if(r.frames.__tcfapiLocator){t=r;break}}catch(t){}if(r===n.top)break;r=r.parent}t||(!function t(){var e=n.document,o=!!n.frames.__tcfapiLocator;if(!o)if(e.body){var r=e.createElement("iframe");r.style.cssText="display:none",r.name="__tcfapiLocator",r.title = "__tcfapiLocator",e.body.appendChild(r)}else setTimeout(t,5);return!o}(),n.__tcfapi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return o;"setGdprApplies"===n[0]?n.length>3&&2===parseInt(n[1],10)&&"boolean"==typeof n[3]&&(e=n[3],"function"==typeof n[2]&&n[2]("set",!0)):"ping"===n[0]?"function"==typeof n[2]&&n[2]({gdprApplies:e,cmpLoaded:!1,cmpStatus:"stub"}):o.push(n)},n.addEventListener("message",(function(t){var e="string"==typeof t.data,o={};if(e)try{o=JSON.parse(t.data)}catch(t){}else o=t.data;var n="object"===_typeof(o)&&null!==o?o.__tcfapiCall:null;n&&window.__tcfapi(n.command,n.version,(function(o,r){var a={__tcfapiReturn:{returnValue:o,success:r,callId:n.callId}};t&&t.source&&t.source.postMessage&&t.source.postMessage(e?JSON.stringify(a):a,"*")}),n.parameter)}),!1))};"undefined"!=typeof module?module.exports=t:t()}();',gppStub:`window.__gpp_addFrame=function(e){if(!window.frames[e])if(document.body){var t=document.createElement("iframe");t.style.cssText="display:none",t.name=e,document.body.appendChild(t)}else window.setTimeout(window.__gpp_addFrame,10,e)},window.__gpp_stub=function(){var e=arguments;if(__gpp.queue=__gpp.queue||[],__gpp.events=__gpp.events||[],!e.length||1==e.length&&"queue"==e[0])return __gpp.queue;if(1==e.length&&"events"==e[0])return __gpp.events;var t=e[0],p=e.length>1?e[1]:null,s=e.length>2?e[2]:null;if("ping"===t)p({gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}},!0);else if("addEventListener"===t){"lastId"in __gpp||(__gpp.lastId=0),__gpp.lastId++;var n=__gpp.lastId;__gpp.events.push({id:n,callback:p,parameter:s}),p({eventName:"listenerRegistered",listenerId:n,data:!0,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else if("removeEventListener"===t){for(var a=!1,i=0;i<__gpp.events.length;i++)if(__gpp.events[i].id==s){__gpp.events.splice(i,1),a=!0;break}p({eventName:"listenerRemoved",listenerId:s,data:a,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnatv1","8:uscav1","9:usvav1","10:uscov1","11:usutv1","12:usctv1"],cmpId:0,sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else"hasSection"===t?p(!1,!0):"getSection"===t||"getField"===t?p(null,!0):__gpp.queue.push([].slice.apply(e))},window.__gpp_msghandler=function(e){var t="string"==typeof e.data;try{var p=t?JSON.parse(e.data):e.data}catch(e){p=null}if("object"==typeof p&&null!==p&&"__gppCall"in p){var s=p.__gppCall;window.__gpp(s.command,(function(p,n){var a={__gppReturn:{returnValue:p,success:n,callId:s.callId}};e.source.postMessage(t?JSON.stringify(a):a,"*")}),"parameter"in s?s.parameter:null,"version"in s?s.version:"1.1")}},"__gpp"in window&&"function"==typeof window.__gpp||(window.__gpp=window.__gpp_stub,window.addEventListener("message",window.__gpp_msghandler,!1),window.__gpp_addFrame("__gppLocator"));
|
|
2
|
+
`};function ne(e){const n=document.createDocumentFragment();return n.appendChild(k("tcf",N.tcfStub)),e.includeUsNat&&n.appendChild(k("gpp",N.gppStub)),n.appendChild(ee(te.cmpFrames)),n}function oe(e,n){const{userId:t,includeUsNat:o}=n;return t&&(e.authId=t),o&&(e.usnat=e.usnat||{}),e}function se(e,n){const{_clientOptions:t,...o}=e,s=oe(o,n);window._sp_={config:s},window._sp_queue??(window._sp_queue=[]),document.head.appendChild(ne(n))}function re(e,n,{formOfWordsId:t,cookieDomain:o}){const r=Object.keys(e).reduce((i,c)=>(i[c]={onsite:{status:e[c],lbi:!1,source:O,fow:t}},i),{});return n?{setConsentCookie:!0,formOfWordsId:t,consentSource:O,cookieDomain:o,data:r}:{data:r,cookieDomain:o}}const m={CALIFORNIA:"uscav1",US_NATIONAL:"usnatv1"},P={[m.CALIFORNIA]:{excludedCategories:{personalisedMarketing:!0}},[m.US_NATIONAL]:{excludedCategories:{personalisedMarketing:!0}}};function ie(e){const{applicableSections:n,supportedAPIs:t}=e,o=n[0];if(o===-1||typeof o>"u")return;const s=t.find(i=>i.startsWith(`${o}:`));return s==null?void 0:s.split(":")[1]}function ce(e){const{SaleOptOut:n,SharingOptOut:t,Gpc:o}=e,{excludedCategories:s}=P[m.CALIFORNIA],r=n!==1&&t!==1&&!o,i={};for(const c of C){if(c in s){i[c]=!0;continue}i[c]=r}return i}function ae(e){const{SaleOptOut:n,SharingOptOut:t,TargetedAdvertisingOptOut:o}=e,{excludedCategories:s}=P[m.US_NATIONAL],r=n!==1&&t!==1&&o!==1,i={};for(const c of C){if(c in s){i[c]=!0;continue}i[c]=r}return i}const pe={[m.CALIFORNIA]:ce,[m.US_NATIONAL]:ae};async function ue(){const e=await new Promise((i,c)=>{try{window.__gpp?window.__gpp("ping",i):c(new Error("GPP API is not available on page"))}catch(a){c(a)}}),{parsedSections:n}=e,t=ie(e);if(!t||!n[t])throw new Error("GPP parser was called without an applicable section");const o=n[t],s=pe[t];if(!s||typeof s!="function")throw new Error(`No parser found for applicable GPP section: ${t}`);return s(o)}function de(e,{purpose:n,vendor:t,specialFeatureOptins:o}){const s=E[e],r=s.purposes.every(a=>(n==null?void 0:n.consents[a])||(n==null?void 0:n.legitimateInterests[a])),i=s.iabVendors.every(a=>(t==null?void 0:t.consents[a])||(t==null?void 0:t.legitimateInterests[a])),c=s.specialFeatures.every(a=>(o==null?void 0:o[a])===!0);return r&&i&&c}async function le(){const e=await new Promise((t,o)=>{try{window.__tcfapi?window.__tcfapi("addEventListener",2,t):o(new Error("TCF API is not available on page"))}catch(s){o(s)}}),n={};for(const t of C)n[t]=de(t,e);return n}async function fe(e){const t={gdpr:le,usnat:ue}[e];if(!t)throw new Error("Unable to update user consent. Unsupported consent legislation.");return t()}function ge(){const n=Object.fromEntries(document.cookie.split("; ").map(o=>o.split("=")))[x];if(!n)return{};const t=decodeURIComponent(n);return Object.fromEntries(t.split(",").map(o=>{const[s,r]=o.split(":");return[s,r==="on"]}))}function me(e,n){return Object.keys(e).some(o=>{const s=`${o.toLowerCase()}Onsite`;return e[o]!==n[s]})}function _e({userId:e,useConsentStore:n}){return!!e&&n===!0}function ve(e,n){return e?`${n.consentProxyHost}/__consent/consent-record/${V}/${n.userId}`:`${n.consentProxyHost}/__consent/consent-record-cookie?cookieDomain=${n.cookieDomain}`}async function ye(e,n){try{const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),credentials:"include"});t.ok||console.error("Unable to save consent preferences",t.status)}catch(t){console.error("An error occurred while saving consent",t)}}function we(e){return async function(t,o,s,r){if(e.disableFTCookies||!e.includeUsNat&&t==="usnat")return;const i=r.applies?t:"gdpr";if(i!==t||!s)return;let c;try{c=await fe(i)}catch(g){console.error(g)}if(!c||!me(c,ge()))return;const p=_e(e),f=ve(p,e),u=re(c,p,e);await ye(f,u),document.dispatchEvent(new CustomEvent("oCookieMessage.act",{bubbles:!0}))}}const b="cookie-message",Ie="manage-cookies";let h=Object.freeze({activeComponent:b,messageId:0,privacyManagerId:0});function Ce(e){return typeof e=="object"&&e!==null&&e.constructor===Object&&Object.prototype.toString.call(e)==="[object Object]"}const be=()=>({...h}),S=e=>{if(!Ce(e)){console.error("Invalid state changes");return}h={...h,...e}},he=["adsDisableInternalCMP","pwm.cmp","messageSlotBottom"];function Se(e,n){const t=Oe(e.flags);window._sp_queue=window._sp_queue??[],window._sp_queue.push(()=>{var o,s;for(const[r,i]of Object.entries(Te))(s=(o=window._sp_).addEventListener)==null||s.call(o,r,i({...e,flags:t}))}),ke({...e,flags:t},n)}function Oe(e){const n={};return typeof e=="object"&&he.forEach(t=>{Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}),n}function Ee(e){if(!e)return;const n=document.body,t=new CustomEvent("oTracking.event",{bubbles:!0,cancelable:!0,detail:e.detail});n.dispatchEvent(t)}function w({trackingProps:e,action:n,triggerAction:t}){let o;const s=be(),{product:r,app:i,flags:c}=e;s.activeComponent===b?o=s.messageId:o=s.privacyManagerId;const a={detail:{component:{id:o,name:s.activeComponent,type:"overlay",subtype:"cmp"},category:"component",action:n,...t&&{trigger_action:t},...r&&{product:r},...i&&{app:i},custom:[{cookie_toggle_flag:c}],url:window.document.location.href||null}};Ee(a)}const Te={onMessageChoiceSelect:e=>(n,t,o)=>{const r={11:"accept_all",12:"manage_cookies",13:"reject_all"}[o];r&&w({trackingProps:e,action:"click",triggerAction:r})},onMessageReady:e=>()=>{w({trackingProps:e,action:"view"})},onMessageReceiveData:()=>(e,n)=>{const{messageId:t}=n;t&&S({messageId:t})},onError:e=>(n,t)=>{w({trackingProps:e,action:"error",triggerAction:t})},onPMCancel:()=>()=>{S({activeComponent:b})}};function ke(e,n){window.addEventListener("message",function(t){if(t.origin!==n)return;const o={1:"save_and_close",11:"accept_all",13:"reject_all"},{data:{fromPM:s,actionType:r,messageId:i="0"}={}}=t;s&&(+i&&S({activeComponent:Ie,privacyManagerId:+i}),!(!r||!o[r])&&w({trackingProps:e,action:"click",triggerAction:o[r]}))},!1)}const Ne="5.0.0";async function Pe(e){const{useFTSession:n=!0,consentProxyHost:t=q,cookieDomain:o=H,formOfWordsId:s=j,useConsentStore:r=!0,trackingContext:i={},disableFTCookies:c=!1,includeUsNat:a=!1}=e||{};let{propertyConfig:p=y,userId:f}=e||{};if(typeof window>"u"){console.error("The CMP client can only be initialised in a browser context");return}if(window.FT_CMP_CLIENT_VERSION=Ne,!f&&n)try{const u=await U();f=u==null?void 0:u.uuid}catch(u){console.error(u)}p=Ae(p),se(p,{userId:f,includeUsNat:a}),window._sp_queue.push(()=>{var u,g;(g=(u=window._sp_)==null?void 0:u.addEventListener)==null||g.call(u,"onConsentReady",we({userId:f,consentProxyHost:t,cookieDomain:o,formOfWordsId:s,useConsentStore:r,disableFTCookies:c,includeUsNat:a}))}),Se(i,p.baseEndpoint)}function Ae(e){if(!(e!=null&&e.accountId))throw new Error("Please pass a valid property config");return e.events&&(console.warn("[cmp-client] Passing an events map in the config is not supported and will be ignored. Please use window._sp_.addEventListener() to listen for events"),delete e.events),e}function A(e,n,t,o,s,r){const{text:i,onClick:c}=o[n],a=document.querySelectorAll(`a[href*="${r}"]`);for(const p of a)(t||e)&&(s.has(p)&&p.removeEventListener("click",s.get(p)),p.innerText=i,p.addEventListener("click",c),s.set(p,c))}function Me({_clientOptions:e}=y){const{privacyManagerId:n,ccpaPrivacyManagerId:t,usnatPrivacyManagerId:o,manageCookiesLinkOverride:s}=e??y._clientOptions,r={usnat:{text:"Do not sell my data",onClick:a=>{var p;a.preventDefault(),(p=window._sp_.usnat)==null||p.loadPrivacyManagerModal(o)}},ccpa:{text:"Do not sell my data",onClick:a=>{var p;a.preventDefault(),(p=window._sp_.ccpa)==null||p.loadPrivacyManagerModal(t)}},gdpr:{text:"Manage cookies",onClick:a=>{var p;a.preventDefault(),(p=window._sp_.gdpr)==null||p.loadPrivacyManagerModal(n)}}},i=new Map,c=function(a,p,f,u){A(!1,a,u.applies,r,i,s),u.applies&&window._sp_queue.push(()=>{var g,D;(D=(g=window._sp_).removeEventListener)==null||D.call(g,"onConsentReady",c)})};A(!0,"gdpr",!1,r,i,s),window._sp_queue??(window._sp_queue=[]),window._sp_queue.push(()=>{var a,p;(p=(a=window._sp_).addEventListener)==null||p.call(a,"onConsentReady",c)})}function Le(e){const n=document.querySelector(e);return n?JSON.parse(n.textContent||"{}"):{}}function De(){return{flags:Le("script#page-kit-flags-embed")}}function Re(e){const{includeUsNat:n}=e._clientOptions||{},{flags:t}=De();return t!=null&&t.adsEnableGpp||n?{includeUsNat:!0}:{}}const Fe={"ft.com":Re};function Ue(e){const{rootDomain:n}=e._clientOptions||{};if(!n)return{};const t=Fe[n];return!t||typeof t!="function"?{}:t(e)}function Ve(e,n){if(!n||Number.isFinite(parseFloat(n))||!e.endsWith(n))return!1;const t=e.indexOf(n),o=e[t-1];return o==="."||o===void 0}function xe(e){if(!e)throw new Error("Invalid hostname provided");let t=Object.values(Q).find(o=>{var r;if(o.propertyHref)return!1;const s=(r=o._clientOptions)==null?void 0:r.rootDomain;return s&&Ve(e,s)});return t??(t=T),t}const je=new URL(window.location.href).hostname,l=xe(je),He=Ue(l);Pe({propertyConfig:l,...He}),(M=l==null?void 0:l._clientOptions)!=null&&M.privacyManagerId&&((L=l==null?void 0:l._clientOptions)!=null&&L.manageCookiesLinkOverride)&&Me(l)})();
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CMPInitOptions } from "../typings/types.d.ts";
|
|
2
|
-
export declare function initSourcepointCmp(
|
|
2
|
+
export declare function initSourcepointCmp(options: CMPInitOptions): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,uBAAuB,CAAC;AAWtE,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,cAAc,iBAiD/D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DeepPartial, GPP } from "../../../typings/types";
|
|
2
|
+
export declare function stubGppPingData(overrideMockData: DeepPartial<GPP.PingData>): void;
|
|
3
|
+
export declare function applyAndStubCaliforniaSection(overrides: Partial<GPP.CaliforniaSection>): void;
|
|
4
|
+
export declare function applyAndStubUsNatSection(overrides: Partial<GPP.UsNatSection>): void;
|
|
5
|
+
export declare function stubGppWithColorado(): void;
|
|
6
|
+
export declare const OPT_IN_CONSENT: {
|
|
7
|
+
permutiveAds: boolean;
|
|
8
|
+
demographicAds: boolean;
|
|
9
|
+
behaviouralAds: boolean;
|
|
10
|
+
programmaticAds: boolean;
|
|
11
|
+
personalisedMarketing: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const OPT_OUT_CONSENT: {
|
|
14
|
+
permutiveAds: boolean;
|
|
15
|
+
demographicAds: boolean;
|
|
16
|
+
behaviouralAds: boolean;
|
|
17
|
+
programmaticAds: boolean;
|
|
18
|
+
personalisedMarketing: boolean;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=gpp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpp.d.ts","sourceRoot":"","sources":["../../../../src/consent-parsers/__fixtures__/gpp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAkD/D,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,QAkB1E;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,QAetF;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,QAe5E;AAED,wBAAgB,mBAAmB,SAIlC;AACD,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;CAM3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/consent-parsers/__tests__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-gpp-consent.test.d.ts","sourceRoot":"","sources":["../../../../../src/consent-parsers/gpp/__tests__/parse-gpp-consent.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/consent-parsers/gpp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AA+EtE,wBAAsB,eAAe,gCA4BpC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Legislation, ParsedConsentState } from "../../typings/types";
|
|
2
|
+
/**
|
|
3
|
+
* Return a dictionary of booleans keyed by IAB category name.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getParsedConsent(activeLegislation: Legislation): Promise<ParsedConsentState>;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/consent-parsers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAItE;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,iBAAiB,EAAE,WAAW,+BAUpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-consent.test.d.ts","sourceRoot":"","sources":["../../../../../src/consent-parsers/tcfv2/__tests__/check-consent.test.ts"],"names":[],"mappings":""}
|
package/dist/src/{consent-ready/utils/get-parsed-consent.d.ts → consent-parsers/tcfv2/index.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IabCustomCategoryName, ParsedConsentState, TCData } from "../../../typings/types";
|
|
2
2
|
/**
|
|
3
3
|
* Checks the consent for a specific custom purpose.
|
|
4
4
|
* @param categoryName - The custom IAB category identifier to check.
|
|
@@ -6,10 +6,5 @@ import type { TCData, ParsedConsentState, IabCustomCategoryName, Legislation } f
|
|
|
6
6
|
* @returns {boolean} - Returns true if consent is granted, otherwise false.
|
|
7
7
|
*/
|
|
8
8
|
export declare function checkConsentFor(categoryName: IabCustomCategoryName, { purpose, vendor, specialFeatureOptins }: Partial<TCData>): boolean;
|
|
9
|
-
export declare function parseCCPAConsent(ccpa: string | null): ParsedConsentState;
|
|
10
9
|
export declare function parseGDPRConsent(): Promise<ParsedConsentState>;
|
|
11
|
-
|
|
12
|
-
* Return a dictionary of booleans keyed by IAB category name.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getParsedConsent(activeLegislation: Legislation, consentString: string): Promise<ParsedConsentState>;
|
|
15
|
-
//# sourceMappingURL=get-parsed-consent.d.ts.map
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/consent-parsers/tcfv2/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhG;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,qBAAqB,EACnC,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,GACzD,OAAO,CAmBT;AAED,wBAAsB,gBAAgB,gCAqBrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/consent-ready/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AA8B/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,iBAE7C,MAAM,gBACL,MAAM,iBACL,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/consent-ready/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AA8B/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,iBAE7C,MAAM,gBACL,MAAM,iBACL,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mBAwCrC"}
|
|
@@ -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
|