@financial-times/cmp-client 2.2.2 → 3.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/README.md +154 -46
- package/dist/index.cjs +176 -121
- package/dist/index.js +176 -121
- package/dist/src/client.d.ts.map +1 -0
- package/dist/{consent-ready → src/consent-ready}/index.d.ts +1 -1
- package/dist/src/consent-ready/index.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__fixtures__/strings.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__tests__/check-consent.test.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__tests__/get-parsed-consent.test.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__tests__/validators.test.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/get-consent-payload.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/get-parsed-consent.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/has-consent-changed.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/validators.d.ts.map +1 -0
- package/dist/src/html/__tests__/cmp-footer-links.test.d.ts.map +1 -0
- package/dist/src/html/__tests__/cmp-scripts.test.d.ts +2 -0
- package/dist/src/html/__tests__/cmp-scripts.test.d.ts.map +1 -0
- package/dist/src/html/cmp-footer-link.d.ts.map +1 -0
- package/dist/src/html/cmp-scripts.d.ts +7 -0
- package/dist/src/html/cmp-scripts.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +1 -2
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/constants.d.ts.map +1 -0
- package/dist/src/lib/debug.d.ts +15 -0
- package/dist/src/lib/debug.d.ts.map +1 -0
- package/dist/src/lib/properties.d.ts +94 -0
- package/dist/src/lib/properties.d.ts.map +1 -0
- package/dist/src/utils/dom.d.ts +3 -0
- package/dist/src/utils/dom.d.ts.map +1 -0
- package/package.json +1 -1
- package/typings/globals.d.ts +4 -12
- package/typings/types.d.ts +11 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/consent-ready/index.d.ts.map +0 -1
- package/dist/consent-ready/utils/__fixtures__/strings.d.ts.map +0 -1
- package/dist/consent-ready/utils/__tests__/check-consent.test.d.ts.map +0 -1
- package/dist/consent-ready/utils/__tests__/get-parsed-consent.test.d.ts.map +0 -1
- package/dist/consent-ready/utils/__tests__/validators.test.d.ts.map +0 -1
- package/dist/consent-ready/utils/get-consent-payload.d.ts.map +0 -1
- package/dist/consent-ready/utils/get-parsed-consent.d.ts.map +0 -1
- package/dist/consent-ready/utils/has-consent-changed.d.ts.map +0 -1
- package/dist/consent-ready/utils/validators.d.ts.map +0 -1
- package/dist/html/__tests__/cmp-footer-links.test.d.ts.map +0 -1
- package/dist/html/cmp-footer-link.d.ts.map +0 -1
- package/dist/html/cmp-scripts.d.ts +0 -16
- package/dist/html/cmp-scripts.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/debug.d.ts +0 -12
- package/dist/lib/debug.d.ts.map +0 -1
- package/dist/lib/properties.d.ts +0 -17
- package/dist/lib/properties.d.ts.map +0 -1
- package/dist/utils/dom.d.ts +0 -3
- package/dist/utils/dom.d.ts.map +0 -1
- /package/dist/{client.d.ts → src/client.d.ts} +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/__fixtures__/strings.d.ts +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/__tests__/check-consent.test.d.ts +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/__tests__/get-parsed-consent.test.d.ts +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/__tests__/validators.test.d.ts +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/get-consent-payload.d.ts +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/get-parsed-consent.d.ts +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/has-consent-changed.d.ts +0 -0
- /package/dist/{consent-ready → src/consent-ready}/utils/validators.d.ts +0 -0
- /package/dist/{html → src/html}/__tests__/cmp-footer-links.test.d.ts +0 -0
- /package/dist/{html → src/html}/cmp-footer-link.d.ts +0 -0
- /package/dist/{lib → src/lib}/constants.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -5,6 +5,150 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
8
|
+
const version = "3.0.0";
|
|
9
|
+
const events = {
|
|
10
|
+
onMessageChoiceSelect: (...args) => {
|
|
11
|
+
console.log("[debug] onMessageChoiceSelect", args);
|
|
12
|
+
},
|
|
13
|
+
onMessageReady: (...args) => {
|
|
14
|
+
console.log("[debug] onMessageReady", args);
|
|
15
|
+
},
|
|
16
|
+
onMessageChoiceError: (...args) => {
|
|
17
|
+
console.log("[debug] onMessageChoiceError", args);
|
|
18
|
+
},
|
|
19
|
+
onPrivacyManagerAction: (...args) => {
|
|
20
|
+
console.log("[debug] onPrivacyManagerAction", args);
|
|
21
|
+
},
|
|
22
|
+
onPMCancel: (...args) => {
|
|
23
|
+
console.log("[debug] onPMCancel", args);
|
|
24
|
+
},
|
|
25
|
+
onMessageReceiveData: (...args) => {
|
|
26
|
+
console.log("[debug] onMessageReceiveData", args);
|
|
27
|
+
},
|
|
28
|
+
onSPPMObjectReady: (...args) => {
|
|
29
|
+
console.log("[debug] onSPPMObjectReady", args);
|
|
30
|
+
},
|
|
31
|
+
onConsentReady: async (...args) => {
|
|
32
|
+
const [legislation2, consentUUID, consentString, consentMeta] = args;
|
|
33
|
+
console.log("[debug] onConsentReady", { legislation: legislation2, consentString, consentMeta, consentUUID });
|
|
34
|
+
},
|
|
35
|
+
onError: (...args) => {
|
|
36
|
+
console.log("[debug] onError", args);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function logCmpEvents() {
|
|
40
|
+
window._sp_queue = window._sp_queue ?? [];
|
|
41
|
+
window._sp_queue.push(() => {
|
|
42
|
+
var _a2, _b2;
|
|
43
|
+
for (const [eventId, eventHandler] of Object.entries(events)) {
|
|
44
|
+
(_b2 = (_a2 = window._sp_).addEventListener) == null ? void 0 : _b2.call(_a2, eventId, eventHandler);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const debug = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
49
|
+
__proto__: null,
|
|
50
|
+
events,
|
|
51
|
+
logCmpEvents
|
|
52
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
53
|
+
const defaults = {
|
|
54
|
+
joinHref: true,
|
|
55
|
+
gdpr: {},
|
|
56
|
+
ccpa: {}
|
|
57
|
+
};
|
|
58
|
+
const FT_DOTCOM_TEST = {
|
|
59
|
+
...defaults,
|
|
60
|
+
accountId: 1906,
|
|
61
|
+
baseEndpoint: "https://consent-manager.ft.com",
|
|
62
|
+
propertyHref: "https://local.ft.com"
|
|
63
|
+
};
|
|
64
|
+
const FT_DOTCOM_PROD = {
|
|
65
|
+
...defaults,
|
|
66
|
+
accountId: 1906,
|
|
67
|
+
baseEndpoint: "https://consent-manager.ft.com",
|
|
68
|
+
propertyId: 31642
|
|
69
|
+
};
|
|
70
|
+
const SP_PWMNET = {
|
|
71
|
+
...defaults,
|
|
72
|
+
accountId: 1906,
|
|
73
|
+
baseEndpoint: "https://consent-manager.pwmnet.com",
|
|
74
|
+
propertyId: 33414
|
|
75
|
+
};
|
|
76
|
+
const SP_FDI_INTELLIGENCE = {
|
|
77
|
+
...defaults,
|
|
78
|
+
accountId: 1906,
|
|
79
|
+
baseEndpoint: "https://consent-manager.fdiintelligence.com",
|
|
80
|
+
propertyId: 34061
|
|
81
|
+
};
|
|
82
|
+
const SP_THE_BANKER = {
|
|
83
|
+
...defaults,
|
|
84
|
+
accountId: 1906,
|
|
85
|
+
baseEndpoint: "https://consent-manager.thebanker.com",
|
|
86
|
+
propertyId: 34060
|
|
87
|
+
};
|
|
88
|
+
const SP_BANKING_RR = {
|
|
89
|
+
...defaults,
|
|
90
|
+
accountId: 1906,
|
|
91
|
+
baseEndpoint: "https://consent-manager.bankingriskandregulation.com",
|
|
92
|
+
propertyId: 34059
|
|
93
|
+
};
|
|
94
|
+
const SP_SUSTAINABLE_VIEWS = {
|
|
95
|
+
...defaults,
|
|
96
|
+
accountId: 1906,
|
|
97
|
+
baseEndpoint: "https://consent-manager.sustainableviews.com",
|
|
98
|
+
propertyId: 34058
|
|
99
|
+
};
|
|
100
|
+
const SP_FT_ADVISER = {
|
|
101
|
+
...defaults,
|
|
102
|
+
accountId: 1906,
|
|
103
|
+
baseEndpoint: "https://consent-manager.ftadviser.com",
|
|
104
|
+
propertyId: 33416
|
|
105
|
+
};
|
|
106
|
+
const SP_INVESTORS_CHRONICLE = {
|
|
107
|
+
...defaults,
|
|
108
|
+
accountId: 1906,
|
|
109
|
+
baseEndpoint: "https://consent-manager.investorschronicle.co.uk",
|
|
110
|
+
propertyId: 33415
|
|
111
|
+
};
|
|
112
|
+
const MM_IGNITES_ASIA = {
|
|
113
|
+
...defaults,
|
|
114
|
+
accountId: 1906,
|
|
115
|
+
baseEndpoint: "https://cdn.privacy-mgmt.com",
|
|
116
|
+
propertyId: 33947
|
|
117
|
+
};
|
|
118
|
+
const MM_IGNITES_EUROPE = {
|
|
119
|
+
...defaults,
|
|
120
|
+
accountId: 1906,
|
|
121
|
+
baseEndpoint: "https://cdn.privacy-mgmt.com",
|
|
122
|
+
propertyId: 33946
|
|
123
|
+
};
|
|
124
|
+
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
125
|
+
__proto__: null,
|
|
126
|
+
FT_DOTCOM_PROD,
|
|
127
|
+
FT_DOTCOM_TEST,
|
|
128
|
+
MM_IGNITES_ASIA,
|
|
129
|
+
MM_IGNITES_EUROPE,
|
|
130
|
+
SP_BANKING_RR,
|
|
131
|
+
SP_FDI_INTELLIGENCE,
|
|
132
|
+
SP_FT_ADVISER,
|
|
133
|
+
SP_INVESTORS_CHRONICLE,
|
|
134
|
+
SP_PWMNET,
|
|
135
|
+
SP_SUSTAINABLE_VIEWS,
|
|
136
|
+
SP_THE_BANKER
|
|
137
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
138
|
+
function updateFooterLinkCMP() {
|
|
139
|
+
const cookieLink = document.querySelector(
|
|
140
|
+
"[href='https://www.ft.com/preferences/manage-cookies']"
|
|
141
|
+
);
|
|
142
|
+
if (cookieLink) {
|
|
143
|
+
cookieLink.href = "#";
|
|
144
|
+
cookieLink.setAttribute("onclick", "window._sp_.gdpr.loadPrivacyManagerModal(827767);");
|
|
145
|
+
cookieLink.dataset.cmpLink = "updated";
|
|
146
|
+
return true;
|
|
147
|
+
} else {
|
|
148
|
+
console.warn("CMP Footer Link was not found and not updated");
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
8
152
|
const request = (url, { credentials = "omit" } = {}) => {
|
|
9
153
|
return fetch(`https://session-next.ft.com${url}`, {
|
|
10
154
|
credentials,
|
|
@@ -111,30 +255,9 @@ const iabCustomCategories = {
|
|
|
111
255
|
specialFeatures: []
|
|
112
256
|
}
|
|
113
257
|
};
|
|
114
|
-
|
|
115
|
-
joinHref: true,
|
|
116
|
-
gdpr: {},
|
|
117
|
-
ccpa: {}
|
|
118
|
-
};
|
|
119
|
-
const FT_DOTCOM_LOCAL = {
|
|
120
|
-
...defaults,
|
|
121
|
-
accountId: 1906,
|
|
122
|
-
baseEndpoint: "https://consent-manager.ft.com",
|
|
123
|
-
propertyHref: "https://local.ft.com"
|
|
124
|
-
};
|
|
125
|
-
const FT_DOTCOM_PROD = {
|
|
126
|
-
...defaults,
|
|
127
|
-
accountId: 1906,
|
|
128
|
-
baseEndpoint: "https://consent-manager.ft.com",
|
|
129
|
-
propertyId: 31642
|
|
130
|
-
};
|
|
131
|
-
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
132
|
-
__proto__: null,
|
|
133
|
-
FT_DOTCOM_LOCAL,
|
|
134
|
-
FT_DOTCOM_PROD
|
|
135
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
136
|
-
function createContentScript(content) {
|
|
258
|
+
function createContentScript(cmpScript, content) {
|
|
137
259
|
const s = document.createElement("script");
|
|
260
|
+
s.dataset.cmpScript = cmpScript;
|
|
138
261
|
s.innerHTML = content;
|
|
139
262
|
return s;
|
|
140
263
|
}
|
|
@@ -143,47 +266,25 @@ function createSourceScript(src) {
|
|
|
143
266
|
s.src = src;
|
|
144
267
|
return s;
|
|
145
268
|
}
|
|
146
|
-
function encodeConfig(obj) {
|
|
147
|
-
let str = "";
|
|
148
|
-
if (!obj)
|
|
149
|
-
return str;
|
|
150
|
-
for (const [key, val] of Object.entries(obj)) {
|
|
151
|
-
switch (typeof val) {
|
|
152
|
-
case "function":
|
|
153
|
-
str += `${key}:${val.toString().replace(/"/g, "'").replace(/\s/g, "")},`;
|
|
154
|
-
break;
|
|
155
|
-
case "string":
|
|
156
|
-
str += `${key}:"${val.replace(/"/g, "'").replace(/\s/g, "")}",`;
|
|
157
|
-
break;
|
|
158
|
-
case "object":
|
|
159
|
-
str += `${key}:{${encodeConfig(val)}},`;
|
|
160
|
-
break;
|
|
161
|
-
default:
|
|
162
|
-
str += `${key}:${val},`;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return str.slice(0, -1);
|
|
167
|
-
}
|
|
168
|
-
function getSPConfig(config) {
|
|
169
|
-
return `window._sp_queue=[];window._sp_={config:{${encodeConfig(config)}}}`;
|
|
170
|
-
}
|
|
171
269
|
const scriptSources = {
|
|
172
270
|
cmpFrames: "https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"
|
|
173
271
|
};
|
|
174
272
|
const scriptContent = {
|
|
175
|
-
getSPConfig,
|
|
176
273
|
tcfStub: `"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){var t=function(){var t,e,o=[],n=window,r=n;for(;r;){try{if(r.frames.__tcfapiLocator){t=r;break}}catch(t){}if(r===n.top)break;r=r.parent}t||(!function t(){var e=n.document,o=!!n.frames.__tcfapiLocator;if(!o)if(e.body){var r=e.createElement("iframe");r.style.cssText="display:none",r.name="__tcfapiLocator",e.body.appendChild(r)}else setTimeout(t,5);return!o}(),n.__tcfapi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return o;"setGdprApplies"===n[0]?n.length>3&&2===parseInt(n[1],10)&&"boolean"==typeof n[3]&&(e=n[3],"function"==typeof n[2]&&n[2]("set",!0)):"ping"===n[0]?"function"==typeof n[2]&&n[2]({gdprApplies:e,cmpLoaded:!1,cmpStatus:"stub"}):o.push(n)},n.addEventListener("message",(function(t){var e="string"==typeof t.data,o={};if(e)try{o=JSON.parse(t.data)}catch(t){}else o=t.data;var n="object"===_typeof(o)&&null!==o?o.__tcfapiCall:null;n&&window.__tcfapi(n.command,n.version,(function(o,r){var a={__tcfapiReturn:{returnValue:o,success:r,callId:n.callId}};t&&t.source&&t.source.postMessage&&t.source.postMessage(e?JSON.stringify(a):a,"*")}),n.parameter)}),!1))};"undefined"!=typeof module?module.exports=t:t()}();`,
|
|
177
274
|
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"; 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) } })();`
|
|
178
275
|
};
|
|
179
|
-
function getCmpScripts(
|
|
276
|
+
function getCmpScripts() {
|
|
180
277
|
const fragment = document.createDocumentFragment();
|
|
181
|
-
fragment.appendChild(createContentScript(scriptContent.tcfStub));
|
|
182
|
-
fragment.appendChild(createContentScript(scriptContent.uspStub));
|
|
183
|
-
fragment.appendChild(createContentScript(scriptContent.getSPConfig(config)));
|
|
278
|
+
fragment.appendChild(createContentScript("tcf", scriptContent.tcfStub));
|
|
279
|
+
fragment.appendChild(createContentScript("usp", scriptContent.uspStub));
|
|
184
280
|
fragment.appendChild(createSourceScript(scriptSources.cmpFrames));
|
|
185
281
|
return fragment;
|
|
186
282
|
}
|
|
283
|
+
function bootstrapCmp(config) {
|
|
284
|
+
window._sp_ = { config };
|
|
285
|
+
window._sp_queue ?? (window._sp_queue = []);
|
|
286
|
+
document.head.appendChild(getCmpScripts());
|
|
287
|
+
}
|
|
187
288
|
function getConsentPayload(parsedConsent, { shouldUpdateConsentStore, formOfWordsId, cookieDomain }) {
|
|
188
289
|
const categoryNames = Object.keys(parsedConsent);
|
|
189
290
|
const data = categoryNames.reduce(
|
|
@@ -1245,7 +1346,7 @@ class VendorVectorEncoder {
|
|
|
1245
1346
|
}
|
|
1246
1347
|
return retrString;
|
|
1247
1348
|
}
|
|
1248
|
-
static decode(value,
|
|
1349
|
+
static decode(value, version2) {
|
|
1249
1350
|
let vector;
|
|
1250
1351
|
let index = 0;
|
|
1251
1352
|
const maxId = IntEncoder.decode(value.substr(index, BitLength.maxId), BitLength.maxId);
|
|
@@ -1254,7 +1355,7 @@ class VendorVectorEncoder {
|
|
|
1254
1355
|
index += BitLength.encodingType;
|
|
1255
1356
|
if (encodingType === VectorEncodingType.RANGE) {
|
|
1256
1357
|
vector = new Vector();
|
|
1257
|
-
if (
|
|
1358
|
+
if (version2 === 1) {
|
|
1258
1359
|
if (value.substr(index, 1) === "1") {
|
|
1259
1360
|
throw new DecodingError("Unable to decode default consent=1");
|
|
1260
1361
|
}
|
|
@@ -1719,12 +1820,12 @@ const _GVL = class _GVL extends Cloneable {
|
|
|
1719
1820
|
throw new GVLError("must specify GVL.baseUrl before loading GVL json");
|
|
1720
1821
|
}
|
|
1721
1822
|
if (versionOrVendorList > 0) {
|
|
1722
|
-
const
|
|
1723
|
-
if (_GVL.CACHE.has(
|
|
1724
|
-
this.populate(_GVL.CACHE.get(
|
|
1823
|
+
const version2 = versionOrVendorList;
|
|
1824
|
+
if (_GVL.CACHE.has(version2)) {
|
|
1825
|
+
this.populate(_GVL.CACHE.get(version2));
|
|
1725
1826
|
this.readyPromise = Promise.resolve();
|
|
1726
1827
|
} else {
|
|
1727
|
-
url += _GVL.versionedFilename.replace("[VERSION]", String(
|
|
1828
|
+
url += _GVL.versionedFilename.replace("[VERSION]", String(version2));
|
|
1728
1829
|
this.readyPromise = this.fetchJson(url);
|
|
1729
1830
|
}
|
|
1730
1831
|
} else {
|
|
@@ -2798,7 +2899,7 @@ async function saveConsent(consentEndpoint, payload) {
|
|
|
2798
2899
|
}
|
|
2799
2900
|
function consentReadyHandlerFn(props) {
|
|
2800
2901
|
const { userId, consentProxyHost, cookieDomain, formOfWordsId, useConsentStore } = props;
|
|
2801
|
-
return async function consentReadyHandler(legislation2,
|
|
2902
|
+
return async function consentReadyHandler(legislation2, _consentUUID, consentString, consentMeta) {
|
|
2802
2903
|
const activeLegislation = consentMeta.applies ? legislation2 : "gdpr";
|
|
2803
2904
|
if (activeLegislation !== legislation2 || !consentString) {
|
|
2804
2905
|
return;
|
|
@@ -2835,6 +2936,7 @@ async function initSourcepointCmp({
|
|
|
2835
2936
|
formOfWordsId = SOURCEPOINT_FOW_ID,
|
|
2836
2937
|
useConsentStore = true
|
|
2837
2938
|
} = {}) {
|
|
2939
|
+
var _a2;
|
|
2838
2940
|
if (!userId && useFTSession) {
|
|
2839
2941
|
try {
|
|
2840
2942
|
const response = await getUuid();
|
|
@@ -2849,71 +2951,24 @@ async function initSourcepointCmp({
|
|
|
2849
2951
|
if (userId) {
|
|
2850
2952
|
propertyConfig.authId = userId;
|
|
2851
2953
|
}
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
window._sp_queue.push(() => {
|
|
2855
|
-
window._sp_.addEventListener(
|
|
2856
|
-
"onConsentReady",
|
|
2857
|
-
consentReadyHandlerFn({
|
|
2858
|
-
userId,
|
|
2859
|
-
consentProxyHost,
|
|
2860
|
-
cookieDomain,
|
|
2861
|
-
formOfWordsId,
|
|
2862
|
-
useConsentStore
|
|
2863
|
-
})
|
|
2864
|
-
);
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
const events = {
|
|
2868
|
-
onMessageChoiceSelect: (...args) => {
|
|
2869
|
-
console.log("[event] onMessageChoiceSelect", args);
|
|
2870
|
-
},
|
|
2871
|
-
onMessageReady: (...args) => {
|
|
2872
|
-
console.log("[event] onMessageReady", args);
|
|
2873
|
-
},
|
|
2874
|
-
onMessageChoiceError: (...args) => {
|
|
2875
|
-
console.log("[event] onMessageChoiceError", args);
|
|
2876
|
-
},
|
|
2877
|
-
onPrivacyManagerAction: (...args) => {
|
|
2878
|
-
console.log("[event] onPrivacyManagerAction", args);
|
|
2879
|
-
},
|
|
2880
|
-
onPMCancel: (...args) => {
|
|
2881
|
-
console.log("[event] onPMCancel", args);
|
|
2882
|
-
},
|
|
2883
|
-
onMessageReceiveData: (...args) => {
|
|
2884
|
-
console.log("[event] onMessageReceiveData", args);
|
|
2885
|
-
},
|
|
2886
|
-
onSPPMObjectReady: (...args) => {
|
|
2887
|
-
console.log("[event] onSPPMObjectReady", args);
|
|
2888
|
-
},
|
|
2889
|
-
onConsentReady: (...args) => {
|
|
2890
|
-
console.log("[event] onConsentReady", args);
|
|
2891
|
-
},
|
|
2892
|
-
onError: (...args) => {
|
|
2893
|
-
console.log("[event] onError", args);
|
|
2894
|
-
}
|
|
2895
|
-
};
|
|
2896
|
-
const debug = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2897
|
-
__proto__: null,
|
|
2898
|
-
events
|
|
2899
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2900
|
-
function updateFooterLinkCMP() {
|
|
2901
|
-
const cookieLink = document.querySelector(
|
|
2902
|
-
"[href='https://www.ft.com/preferences/manage-cookies']"
|
|
2903
|
-
);
|
|
2904
|
-
if (cookieLink) {
|
|
2905
|
-
cookieLink.href = "#";
|
|
2906
|
-
cookieLink.setAttribute("onclick", "window._sp_.gdpr.loadPrivacyManagerModal(827767);");
|
|
2907
|
-
cookieLink.dataset.cmpLink = "updated";
|
|
2908
|
-
return true;
|
|
2909
|
-
} else {
|
|
2910
|
-
console.warn("CMP Footer Link was not found and not updated");
|
|
2911
|
-
return false;
|
|
2954
|
+
if ((_a2 = propertyConfig.events) == null ? void 0 : _a2.onConsentReady) {
|
|
2955
|
+
console.warn("[cmp-client] The supplied 'onConsentReady' event handler will be overwritten.");
|
|
2912
2956
|
}
|
|
2957
|
+
const events2 = {
|
|
2958
|
+
...propertyConfig.events ?? {},
|
|
2959
|
+
onConsentReady: consentReadyHandlerFn({
|
|
2960
|
+
userId,
|
|
2961
|
+
consentProxyHost,
|
|
2962
|
+
cookieDomain,
|
|
2963
|
+
formOfWordsId,
|
|
2964
|
+
useConsentStore
|
|
2965
|
+
})
|
|
2966
|
+
};
|
|
2967
|
+
bootstrapCmp({ ...propertyConfig, events: events2 });
|
|
2913
2968
|
}
|
|
2969
|
+
window.FT_CMP_CLIENT_VERSION = version;
|
|
2914
2970
|
export {
|
|
2915
2971
|
debug,
|
|
2916
|
-
getCmpScripts,
|
|
2917
2972
|
initSourcepointCmp,
|
|
2918
2973
|
properties,
|
|
2919
2974
|
updateFooterLinkCMP
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAS5D,wBAAsB,kBAAkB,CAAC,EACvC,cAA+B,EAC/B,MAAM,EACN,YAAmB,EACnB,gBAAwC,EACxC,YAA+B,EAC/B,aAAkC,EAClC,eAAsB,GACvB,GAAE,cAAmB,iBAkCrB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConsentReadyProps } from "../../typings/types.d.ts";
|
|
2
|
-
export declare function consentReadyHandlerFn(props: ConsentReadyProps): (legislation: string,
|
|
2
|
+
export declare function consentReadyHandlerFn(props: ConsentReadyProps): (legislation: string, _consentUUID: string, consentString: string, consentMeta: {
|
|
3
3
|
applies?: boolean;
|
|
4
4
|
}) => Promise<void>;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AA0B/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,iBAI7C,MAAM,gBACL,MAAM,iBACL,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mBAoCrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../../../src/consent-ready/utils/__fixtures__/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,qPACiN,CAAC;AAErP;;GAEG;AACH,eAAO,MAAM,2BAA2B,qPAC4M,CAAC;AAErP,eAAO,MAAM,wBAAwB,obAC8Y,CAAC;AAEpb,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAC3C,eAAO,MAAM,kBAAkB,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-consent.test.d.ts","sourceRoot":"","sources":["../../../../../src/consent-ready/utils/__tests__/check-consent.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-parsed-consent.test.d.ts","sourceRoot":"","sources":["../../../../../src/consent-ready/utils/__tests__/get-parsed-consent.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.test.d.ts","sourceRoot":"","sources":["../../../../../src/consent-ready/utils/__tests__/validators.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-consent-payload.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/get-consent-payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAIhC;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,kBAAkB,EACjC,EAAE,wBAAwB,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC;;;;;;;;;;;;EA6B1F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-parsed-consent.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/get-parsed-consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EACf,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AAOrC;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,GAAG,OAAO,CA8B5F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,eAAe,GAAG,kBAAkB,CAMrF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-consent-changed.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/has-consent-changed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAoBjE,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,kBAAkB,GAAG,OAAO,CAO5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAU5D;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAO5D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,IAAI,eAAe,CAsBxF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAIrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmp-footer-links.test.d.ts","sourceRoot":"","sources":["../../../../src/html/__tests__/cmp-footer-links.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmp-scripts.test.d.ts","sourceRoot":"","sources":["../../../../src/html/__tests__/cmp-scripts.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmp-footer-link.d.ts","sourceRoot":"","sources":["../../../src/html/cmp-footer-link.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAa7C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SPConfig } from "../../typings/types";
|
|
2
|
+
/**
|
|
3
|
+
* Set up the config and event handlers for the CMP
|
|
4
|
+
* Then add the vendor scripts to the head of the document
|
|
5
|
+
*/
|
|
6
|
+
export declare function bootstrapCmp(config: SPConfig): void;
|
|
7
|
+
//# sourceMappingURL=cmp-scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmp-scripts.d.ts","sourceRoot":"","sources":["../../../src/html/cmp-scripts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAsBpD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,QAK5C"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { initSourcepointCmp } from "./client";
|
|
2
1
|
export * as debug from "./lib/debug.ts";
|
|
3
2
|
export * as properties from "./lib/properties.ts";
|
|
4
3
|
export { updateFooterLinkCMP } from "./html/cmp-footer-link.ts";
|
|
5
|
-
export {
|
|
4
|
+
export { initSourcepointCmp } from "./client";
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAC5D,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C,eAAO,MAAM,kBAAkB,oDAAoD,CAAC;AACpF,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAE9D,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAyBjE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const events: {
|
|
2
|
+
onMessageChoiceSelect: (...args: never) => void;
|
|
3
|
+
onMessageReady: (...args: never) => void;
|
|
4
|
+
onMessageChoiceError: (...args: never) => void;
|
|
5
|
+
onPrivacyManagerAction: (...args: never) => void;
|
|
6
|
+
onPMCancel: (...args: never) => void;
|
|
7
|
+
onMessageReceiveData: (...args: never) => void;
|
|
8
|
+
onSPPMObjectReady: (...args: never) => void;
|
|
9
|
+
onConsentReady: (legislation: string, consentUUID: string, consentString: string, consentMeta: {
|
|
10
|
+
applies?: boolean | undefined;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
onError: (...args: never) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function logCmpEvents(): void;
|
|
15
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/lib/debug.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;qCACgB,KAAK;8BAGZ,KAAK;oCAGC,KAAK;sCAGH,KAAK;0BAGjB,KAAK;oCAGK,KAAK;iCAGR,KAAK;;kBAQL,OAAO,GAAG,SAAS;;uBAM7B,KAAK;CAGzB,CAAC;AAEF,wBAAgB,YAAY,SAO3B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This config should only be used to test unregistered properties.
|
|
3
|
+
* Properties on *.ft.com are by default registered.
|
|
4
|
+
* The propertyHref value spoofs the request to Sourcepoint as coming from an FT domain
|
|
5
|
+
*/
|
|
6
|
+
export declare const FT_DOTCOM_TEST: {
|
|
7
|
+
accountId: number;
|
|
8
|
+
baseEndpoint: string;
|
|
9
|
+
propertyHref: string;
|
|
10
|
+
joinHref: boolean;
|
|
11
|
+
gdpr: {};
|
|
12
|
+
ccpa: {};
|
|
13
|
+
};
|
|
14
|
+
export declare const FT_DOTCOM_PROD: {
|
|
15
|
+
accountId: number;
|
|
16
|
+
baseEndpoint: string;
|
|
17
|
+
propertyId: number;
|
|
18
|
+
joinHref: boolean;
|
|
19
|
+
gdpr: {};
|
|
20
|
+
ccpa: {};
|
|
21
|
+
};
|
|
22
|
+
export declare const SP_PWMNET: {
|
|
23
|
+
accountId: number;
|
|
24
|
+
baseEndpoint: string;
|
|
25
|
+
propertyId: number;
|
|
26
|
+
joinHref: boolean;
|
|
27
|
+
gdpr: {};
|
|
28
|
+
ccpa: {};
|
|
29
|
+
};
|
|
30
|
+
export declare const SP_FDI_INTELLIGENCE: {
|
|
31
|
+
accountId: number;
|
|
32
|
+
baseEndpoint: string;
|
|
33
|
+
propertyId: number;
|
|
34
|
+
joinHref: boolean;
|
|
35
|
+
gdpr: {};
|
|
36
|
+
ccpa: {};
|
|
37
|
+
};
|
|
38
|
+
export declare const SP_THE_BANKER: {
|
|
39
|
+
accountId: number;
|
|
40
|
+
baseEndpoint: string;
|
|
41
|
+
propertyId: number;
|
|
42
|
+
joinHref: boolean;
|
|
43
|
+
gdpr: {};
|
|
44
|
+
ccpa: {};
|
|
45
|
+
};
|
|
46
|
+
export declare const SP_BANKING_RR: {
|
|
47
|
+
accountId: number;
|
|
48
|
+
baseEndpoint: string;
|
|
49
|
+
propertyId: number;
|
|
50
|
+
joinHref: boolean;
|
|
51
|
+
gdpr: {};
|
|
52
|
+
ccpa: {};
|
|
53
|
+
};
|
|
54
|
+
export declare const SP_SUSTAINABLE_VIEWS: {
|
|
55
|
+
accountId: number;
|
|
56
|
+
baseEndpoint: string;
|
|
57
|
+
propertyId: number;
|
|
58
|
+
joinHref: boolean;
|
|
59
|
+
gdpr: {};
|
|
60
|
+
ccpa: {};
|
|
61
|
+
};
|
|
62
|
+
export declare const SP_FT_ADVISER: {
|
|
63
|
+
accountId: number;
|
|
64
|
+
baseEndpoint: string;
|
|
65
|
+
propertyId: number;
|
|
66
|
+
joinHref: boolean;
|
|
67
|
+
gdpr: {};
|
|
68
|
+
ccpa: {};
|
|
69
|
+
};
|
|
70
|
+
export declare const SP_INVESTORS_CHRONICLE: {
|
|
71
|
+
accountId: number;
|
|
72
|
+
baseEndpoint: string;
|
|
73
|
+
propertyId: number;
|
|
74
|
+
joinHref: boolean;
|
|
75
|
+
gdpr: {};
|
|
76
|
+
ccpa: {};
|
|
77
|
+
};
|
|
78
|
+
export declare const MM_IGNITES_ASIA: {
|
|
79
|
+
accountId: number;
|
|
80
|
+
baseEndpoint: string;
|
|
81
|
+
propertyId: number;
|
|
82
|
+
joinHref: boolean;
|
|
83
|
+
gdpr: {};
|
|
84
|
+
ccpa: {};
|
|
85
|
+
};
|
|
86
|
+
export declare const MM_IGNITES_EUROPE: {
|
|
87
|
+
accountId: number;
|
|
88
|
+
baseEndpoint: string;
|
|
89
|
+
propertyId: number;
|
|
90
|
+
joinHref: boolean;
|
|
91
|
+
gdpr: {};
|
|
92
|
+
ccpa: {};
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/lib/properties.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;CAK1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CAK1B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;CAK/B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;CAKhC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAKlC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;CAK3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAK7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAKrE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,qBAI7C"}
|
package/package.json
CHANGED
package/typings/globals.d.ts
CHANGED
|
@@ -2,19 +2,11 @@ export {};
|
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
|
+
FT_CMP_CLIENT_VERSION: string;
|
|
5
6
|
_sp_: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
callback: (
|
|
9
|
-
legislation: string,
|
|
10
|
-
_: string,
|
|
11
|
-
consentString: string,
|
|
12
|
-
consentMeta: Record<string, unknown>,
|
|
13
|
-
) => Promise<void>,
|
|
14
|
-
) => void;
|
|
15
|
-
};
|
|
16
|
-
_sp_queue: {
|
|
17
|
-
push: (f: () => void) => void;
|
|
7
|
+
config: SPConfig;
|
|
8
|
+
addEventListener?: (e: string, callback: SPEventCallback) => void;
|
|
18
9
|
};
|
|
10
|
+
_sp_queue: (() => void)[];
|
|
19
11
|
}
|
|
20
12
|
}
|
package/typings/types.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { iabCustomCategories } from "../src/lib/constants.ts";
|
|
|
4
4
|
|
|
5
5
|
export type SPLifecycleEvents = Partial<typeof events>;
|
|
6
6
|
|
|
7
|
+
export type SPEventId = keyof SPLifecycleEvents;
|
|
8
|
+
|
|
7
9
|
export interface SPConfig {
|
|
8
10
|
accountId: number;
|
|
9
11
|
baseEndpoint: string;
|
|
@@ -12,10 +14,17 @@ export interface SPConfig {
|
|
|
12
14
|
propertyHref?: string;
|
|
13
15
|
propertyId?: number;
|
|
14
16
|
joinHref?: boolean;
|
|
15
|
-
events?: SPLifecycleEvents
|
|
17
|
+
events?: Partial<SPLifecycleEvents>;
|
|
16
18
|
authId?: string;
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
export type SPEventCallback = (
|
|
22
|
+
legislation: string,
|
|
23
|
+
_: string,
|
|
24
|
+
consentString: string,
|
|
25
|
+
consentMeta: Record<string, unknown>,
|
|
26
|
+
) => Promise<void>;
|
|
27
|
+
|
|
19
28
|
export type CMPInitOptions = Partial<{
|
|
20
29
|
propertyConfig: SPConfig;
|
|
21
30
|
userId?: string;
|
|
@@ -24,6 +33,7 @@ export type CMPInitOptions = Partial<{
|
|
|
24
33
|
cookieDomain: string;
|
|
25
34
|
formOfWordsId: string;
|
|
26
35
|
useConsentStore: boolean;
|
|
36
|
+
spEventHandlers: [eventId: SPEventId, eventHandler: SPEventCallback][];
|
|
27
37
|
}>;
|
|
28
38
|
|
|
29
39
|
export interface ConsentPayloadOptions {
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAS5D,wBAAsB,kBAAkB,CAAC,EACvC,cAA+B,EAC/B,MAAM,EACN,YAAmB,EACnB,gBAAwC,EACxC,YAA+B,EAC/B,aAAkC,EAClC,eAAsB,GACvB,GAAE,cAAmB,iBAiCrB"}
|