@financial-times/cmp-client 2.2.2 → 2.2.3-alpha
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 +91 -35
- package/dist/index.cjs +113 -121
- package/dist/index.js +113 -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 +22 -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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CMP Client
|
|
2
2
|
|
|
3
|
-
A package to help you add a CMP (currently provided by Sourcepoint) to your application.
|
|
3
|
+
A client-side package to help you add a CMP (currently provided by Sourcepoint) to your application.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -24,64 +24,120 @@ Visit https://localhost:5173 (see setup details in `src/examples/cmp-client`) to
|
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
26
|
import { initSourcepointCmp } from "@financial-times/cmp-client/client";
|
|
27
|
-
import {
|
|
27
|
+
import { FT_DOTCOM_TEST } from "@financial-times/cmp-client/properties";
|
|
28
28
|
|
|
29
29
|
// we suggest using a feature flag to disable the existing cookie banner and enable the new one
|
|
30
30
|
if (flagsClient.get("adsDisableInternalCMP")) {
|
|
31
31
|
initSourcepointCmp({
|
|
32
|
-
propertyConfig:
|
|
33
|
-
// useConsentStore: false (set to false
|
|
32
|
+
propertyConfig: FT_DOTCOM_TEST,
|
|
33
|
+
// useConsentStore: false (set to false for non-FT.com properties or websites)
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
We will be adding new properties and their configs as we start rolling out. Please reach out to the Ads & Privacy team if you think you need to create a new property for your domain
|
|
38
|
+
We will be adding new properties (websites under FT group) and their configs as we start rolling out. Please reach out to the Ads & Privacy team if you think you need to create a new property for your domain - for example, if it is on a different domain from the `ft.com` domain.
|
|
39
39
|
|
|
40
40
|
### CMP configuration options:
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
<table>
|
|
43
|
+
<thead>
|
|
44
|
+
<tr>
|
|
45
|
+
<th>Option</th>
|
|
46
|
+
<th>Description</th>
|
|
47
|
+
</tr>
|
|
48
|
+
<thead/>
|
|
49
|
+
<tbody>
|
|
50
|
+
<tr>
|
|
51
|
+
<td><code>propertyConfig</code> (SourcepointConfig)</td>
|
|
52
|
+
<td>This config object is directly passed to Sourcepoint (our external CMP) and presets (imported like example usage) will be made available for different properties/titles under the FT group. This currently defaults to the <code>FT_DOTCOM_PROD</code> preset</td>
|
|
53
|
+
</tr>
|
|
54
|
+
<tr>
|
|
55
|
+
<td><code>userId</code> (string)</td>
|
|
56
|
+
<td>Please provide a userId if the user is a logged in user. If your app uses the FT Secure Session token, you can leave empty and set <code>useFTSession</code> to true instead. Defaults to <code>undefined</code> for anonymous users</td>
|
|
57
|
+
</tr>
|
|
58
|
+
<tr>
|
|
59
|
+
<td><code>useFTSession</code> (boolean)</td>
|
|
60
|
+
<td>Set this flag if you want the user's Id to be automatically derived from their FT Secure Session. Set to <code>false</code> if your app doesn't use FT Secure Session. Defaults to <code>true</code></td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td><code>consentProxyHost</code> (string)</td>
|
|
64
|
+
<td>The fully qualified domain name for your consent proxy instance e.g <code>https://consent.thebanker.com</code>. Defaults to <code>https://consent.ft.com</code></td>
|
|
65
|
+
</tr>
|
|
66
|
+
<tr>
|
|
67
|
+
<td><code>cookieDomain</code> (string)</td>
|
|
68
|
+
<td>The domain (and subdomains) that the FTConsent cookie will apply to e.g <code>.thebanker.com</code>. Defaults to <code>.ft.com</code></td>
|
|
69
|
+
</tr>
|
|
70
|
+
<tr>
|
|
71
|
+
<td><code>formOfWordsId</code> (string)</td>
|
|
72
|
+
<td>The IAB custom categories that you have adapted might be tracked under a different FOW ID. At the moment, all custom categories are tracked under the <code>sourcepointCmp</code> form-of-words and it defaults to <code>sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk</code>. Properties using the consent banner as presented should use the default value</td>
|
|
73
|
+
</tr>
|
|
74
|
+
<tr>
|
|
75
|
+
<td><code>useConsentStore</code> (boolean)</td>
|
|
76
|
+
<td>Specifies whether the user's consent record should also be backed by the Single Consent Store. Properties like Specialist titles will need to explicitly set this to <code>false</code> as <code>true</code> is the default behavior</td>
|
|
77
|
+
</tr>
|
|
78
|
+
<tr>
|
|
79
|
+
<td><code>events</code> (object)</td>
|
|
80
|
+
<td>Used internally to define handlers for events emitted by the Vendor-supplied CMP module. See notes on "Responding to CMP events" below for details on how to define custom event handlers</td>
|
|
81
|
+
</tr>
|
|
82
|
+
</tbody>
|
|
83
|
+
<table/>
|
|
84
|
+
|
|
85
|
+
## Responding to CMP events
|
|
86
|
+
|
|
87
|
+
If you need to do additional work in response to events emitted by the CMP Vendor module you can do so via the `window._sp_.addEventListener` method:
|
|
51
88
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
| `FT_DOTCOM_LOCAL` | Configuration preset for all properties on FT.com domain operating in a local environment - `https://local.ft.com` |
|
|
57
|
-
| `FT_DOTCOM_PROD` | Configuration preset for all properties on FT.com domain operating in a production environment - `https://*.ft.com` |
|
|
89
|
+
```js
|
|
90
|
+
window._sp_.addEventListener("onMessageReady", (messageType) => {... });
|
|
91
|
+
window._sp_.addEventListener("onConsentReady", (legislation, consentUUID, consentString, consentMeta) => { ... });
|
|
92
|
+
```
|
|
58
93
|
|
|
59
|
-
|
|
94
|
+
> [!Note]
|
|
95
|
+
> The `onConsentReady` event is fired
|
|
96
|
+
>
|
|
97
|
+
> 1. As soon as the CMP has finished loading and the user's consent choices are available
|
|
98
|
+
> 1. Subsequently, whenever the user's consent choices change
|
|
60
99
|
|
|
61
|
-
|
|
100
|
+
See the [Sourcepoint docs](https://docs.sourcepoint.com/hc/en-us/articles/4412176150035-Queue-event-callbacks) for a full listing of the events you can listen for and the arguments passed to the callbacks.
|
|
62
101
|
|
|
63
|
-
|
|
64
|
-
import { getCmpScripts } from "@financial-times/cmp-client/client";
|
|
65
|
-
import { FT_DOTCOM_LOCAL } from "@financial-times/cmp-client/properties";
|
|
102
|
+
### Available Properties (constantly being updated)
|
|
66
103
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
104
|
+
<table>
|
|
105
|
+
<thead>
|
|
106
|
+
<tr>
|
|
107
|
+
<th>Property Key</th>
|
|
108
|
+
<th>Details</th>
|
|
109
|
+
</tr>
|
|
110
|
+
<thead/>
|
|
111
|
+
<tbody>
|
|
112
|
+
<tr>
|
|
113
|
+
<td><code>FT_DOTCOM_TEST</code></td>
|
|
114
|
+
<td>
|
|
115
|
+
<p>Use this configuration preset for testing the CMP on a property that has not yet been registered in the Sourcepoint portal.</p>
|
|
116
|
+
<p>All <code>*.ft.com</code> are currently registered and this config will spoof your request as coming from <code>https://local.ft.com</code>
|
|
117
|
+
</p>
|
|
118
|
+
</td>
|
|
119
|
+
</tr>
|
|
120
|
+
<tr>
|
|
121
|
+
<td><code>FT_DOTCOM_PROD</code></td>
|
|
122
|
+
<td>Configuration preset for all properties on FT.com domain operating in a production environment - <code>https://*.ft.com</code></td>
|
|
123
|
+
</tr>
|
|
124
|
+
</tbody>
|
|
125
|
+
<table/>
|
|
70
126
|
|
|
71
127
|
## Debugging
|
|
72
128
|
|
|
73
|
-
You can verify that the CMP is correctly configured
|
|
129
|
+
You can verify that the CMP is correctly configured with the `debug` module, as deomstrated in [the CMP Client example](src/examples/src/scripts/cmp-client.ts):
|
|
74
130
|
|
|
75
131
|
```js
|
|
76
|
-
import {
|
|
77
|
-
import { ft } from "@financial-times/cmp-client/properties";
|
|
78
|
-
import { events } from "@financial-times/cmp-client/debug";
|
|
132
|
+
import { debug } from "@financial-times/cmp-client";
|
|
79
133
|
|
|
80
|
-
|
|
81
|
-
const config = { ...ft, events };
|
|
82
|
-
document.head.appendChild(getCmpScripts(config));
|
|
134
|
+
debug.logCmpEvents();
|
|
83
135
|
```
|
|
84
136
|
|
|
85
137
|
If everything's working then when running the demo app you'll see the CMP log its lifecycle events to the console, _even if its UI isn't displayed_.
|
|
86
138
|
|
|
87
139
|
This can easily happen when you've made a previous consent choice and the CMP is now picking it up from local storage. We recommend running in an incognito window during development.
|
|
140
|
+
|
|
141
|
+
## How it works
|
|
142
|
+
|
|
143
|
+
The overview of how the CMP client works is diagrammatically [presented here](https://financialtimes.atlassian.net/wiki/spaces/ADS/pages/8151990292/New+Consent+Migration+Guide+for+teams#What-happens-when-a-user-visits-%5BinlineCard%5D--in-the-new-consent-framework%3F)
|
package/dist/index.cjs
CHANGED
|
@@ -7,6 +7,87 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
};
|
|
8
8
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
9
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
const version = "2.2.3-alpha";
|
|
11
|
+
const events = {
|
|
12
|
+
onMessageChoiceSelect: (...args) => {
|
|
13
|
+
console.log("[debug] onMessageChoiceSelect", args);
|
|
14
|
+
},
|
|
15
|
+
onMessageReady: (...args) => {
|
|
16
|
+
console.log("[debug] onMessageReady", args);
|
|
17
|
+
},
|
|
18
|
+
onMessageChoiceError: (...args) => {
|
|
19
|
+
console.log("[debug] onMessageChoiceError", args);
|
|
20
|
+
},
|
|
21
|
+
onPrivacyManagerAction: (...args) => {
|
|
22
|
+
console.log("[debug] onPrivacyManagerAction", args);
|
|
23
|
+
},
|
|
24
|
+
onPMCancel: (...args) => {
|
|
25
|
+
console.log("[debug] onPMCancel", args);
|
|
26
|
+
},
|
|
27
|
+
onMessageReceiveData: (...args) => {
|
|
28
|
+
console.log("[debug] onMessageReceiveData", args);
|
|
29
|
+
},
|
|
30
|
+
onSPPMObjectReady: (...args) => {
|
|
31
|
+
console.log("[debug] onSPPMObjectReady", args);
|
|
32
|
+
},
|
|
33
|
+
onConsentReady: async (...args) => {
|
|
34
|
+
const [legislation2, consentUUID, consentString, consentMeta] = args;
|
|
35
|
+
console.log("[debug] onConsentReady", { legislation: legislation2, consentString, consentMeta, consentUUID });
|
|
36
|
+
},
|
|
37
|
+
onError: (...args) => {
|
|
38
|
+
console.log("[debug] onError", args);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function logCmpEvents() {
|
|
42
|
+
window._sp_queue = window._sp_queue ?? [];
|
|
43
|
+
window._sp_queue.push(() => {
|
|
44
|
+
var _a2, _b2;
|
|
45
|
+
for (const [eventId, eventHandler] of Object.entries(events)) {
|
|
46
|
+
(_b2 = (_a2 = window._sp_).addEventListener) == null ? void 0 : _b2.call(_a2, eventId, eventHandler);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const debug = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
51
|
+
__proto__: null,
|
|
52
|
+
events,
|
|
53
|
+
logCmpEvents
|
|
54
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
55
|
+
const defaults = {
|
|
56
|
+
joinHref: true,
|
|
57
|
+
gdpr: {},
|
|
58
|
+
ccpa: {}
|
|
59
|
+
};
|
|
60
|
+
const FT_DOTCOM_TEST = {
|
|
61
|
+
...defaults,
|
|
62
|
+
accountId: 1906,
|
|
63
|
+
baseEndpoint: "https://consent-manager.ft.com",
|
|
64
|
+
propertyHref: "https://local.ft.com"
|
|
65
|
+
};
|
|
66
|
+
const FT_DOTCOM_PROD = {
|
|
67
|
+
...defaults,
|
|
68
|
+
accountId: 1906,
|
|
69
|
+
baseEndpoint: "https://consent-manager.ft.com",
|
|
70
|
+
propertyId: 31642
|
|
71
|
+
};
|
|
72
|
+
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
73
|
+
__proto__: null,
|
|
74
|
+
FT_DOTCOM_PROD,
|
|
75
|
+
FT_DOTCOM_TEST
|
|
76
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
77
|
+
function updateFooterLinkCMP() {
|
|
78
|
+
const cookieLink = document.querySelector(
|
|
79
|
+
"[href='https://www.ft.com/preferences/manage-cookies']"
|
|
80
|
+
);
|
|
81
|
+
if (cookieLink) {
|
|
82
|
+
cookieLink.href = "#";
|
|
83
|
+
cookieLink.setAttribute("onclick", "window._sp_.gdpr.loadPrivacyManagerModal(827767);");
|
|
84
|
+
cookieLink.dataset.cmpLink = "updated";
|
|
85
|
+
return true;
|
|
86
|
+
} else {
|
|
87
|
+
console.warn("CMP Footer Link was not found and not updated");
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
10
91
|
const request = (url, { credentials = "omit" } = {}) => {
|
|
11
92
|
return fetch(`https://session-next.ft.com${url}`, {
|
|
12
93
|
credentials,
|
|
@@ -113,30 +194,9 @@ const iabCustomCategories = {
|
|
|
113
194
|
specialFeatures: []
|
|
114
195
|
}
|
|
115
196
|
};
|
|
116
|
-
|
|
117
|
-
joinHref: true,
|
|
118
|
-
gdpr: {},
|
|
119
|
-
ccpa: {}
|
|
120
|
-
};
|
|
121
|
-
const FT_DOTCOM_LOCAL = {
|
|
122
|
-
...defaults,
|
|
123
|
-
accountId: 1906,
|
|
124
|
-
baseEndpoint: "https://consent-manager.ft.com",
|
|
125
|
-
propertyHref: "https://local.ft.com"
|
|
126
|
-
};
|
|
127
|
-
const FT_DOTCOM_PROD = {
|
|
128
|
-
...defaults,
|
|
129
|
-
accountId: 1906,
|
|
130
|
-
baseEndpoint: "https://consent-manager.ft.com",
|
|
131
|
-
propertyId: 31642
|
|
132
|
-
};
|
|
133
|
-
const properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
134
|
-
__proto__: null,
|
|
135
|
-
FT_DOTCOM_LOCAL,
|
|
136
|
-
FT_DOTCOM_PROD
|
|
137
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
138
|
-
function createContentScript(content) {
|
|
197
|
+
function createContentScript(cmpScript, content) {
|
|
139
198
|
const s = document.createElement("script");
|
|
199
|
+
s.dataset.cmpScript = cmpScript;
|
|
140
200
|
s.innerHTML = content;
|
|
141
201
|
return s;
|
|
142
202
|
}
|
|
@@ -145,47 +205,25 @@ function createSourceScript(src) {
|
|
|
145
205
|
s.src = src;
|
|
146
206
|
return s;
|
|
147
207
|
}
|
|
148
|
-
function encodeConfig(obj) {
|
|
149
|
-
let str = "";
|
|
150
|
-
if (!obj)
|
|
151
|
-
return str;
|
|
152
|
-
for (const [key, val] of Object.entries(obj)) {
|
|
153
|
-
switch (typeof val) {
|
|
154
|
-
case "function":
|
|
155
|
-
str += `${key}:${val.toString().replace(/"/g, "'").replace(/\s/g, "")},`;
|
|
156
|
-
break;
|
|
157
|
-
case "string":
|
|
158
|
-
str += `${key}:"${val.replace(/"/g, "'").replace(/\s/g, "")}",`;
|
|
159
|
-
break;
|
|
160
|
-
case "object":
|
|
161
|
-
str += `${key}:{${encodeConfig(val)}},`;
|
|
162
|
-
break;
|
|
163
|
-
default:
|
|
164
|
-
str += `${key}:${val},`;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return str.slice(0, -1);
|
|
169
|
-
}
|
|
170
|
-
function getSPConfig(config) {
|
|
171
|
-
return `window._sp_queue=[];window._sp_={config:{${encodeConfig(config)}}}`;
|
|
172
|
-
}
|
|
173
208
|
const scriptSources = {
|
|
174
209
|
cmpFrames: "https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"
|
|
175
210
|
};
|
|
176
211
|
const scriptContent = {
|
|
177
|
-
getSPConfig,
|
|
178
212
|
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()}();`,
|
|
179
213
|
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) } })();`
|
|
180
214
|
};
|
|
181
|
-
function getCmpScripts(
|
|
215
|
+
function getCmpScripts() {
|
|
182
216
|
const fragment = document.createDocumentFragment();
|
|
183
|
-
fragment.appendChild(createContentScript(scriptContent.tcfStub));
|
|
184
|
-
fragment.appendChild(createContentScript(scriptContent.uspStub));
|
|
185
|
-
fragment.appendChild(createContentScript(scriptContent.getSPConfig(config)));
|
|
217
|
+
fragment.appendChild(createContentScript("tcf", scriptContent.tcfStub));
|
|
218
|
+
fragment.appendChild(createContentScript("usp", scriptContent.uspStub));
|
|
186
219
|
fragment.appendChild(createSourceScript(scriptSources.cmpFrames));
|
|
187
220
|
return fragment;
|
|
188
221
|
}
|
|
222
|
+
function bootstrapCmp(config) {
|
|
223
|
+
window._sp_ = { config };
|
|
224
|
+
window._sp_queue ?? (window._sp_queue = []);
|
|
225
|
+
document.head.appendChild(getCmpScripts());
|
|
226
|
+
}
|
|
189
227
|
function getConsentPayload(parsedConsent, { shouldUpdateConsentStore, formOfWordsId, cookieDomain }) {
|
|
190
228
|
const categoryNames = Object.keys(parsedConsent);
|
|
191
229
|
const data = categoryNames.reduce(
|
|
@@ -1247,7 +1285,7 @@ class VendorVectorEncoder {
|
|
|
1247
1285
|
}
|
|
1248
1286
|
return retrString;
|
|
1249
1287
|
}
|
|
1250
|
-
static decode(value,
|
|
1288
|
+
static decode(value, version2) {
|
|
1251
1289
|
let vector;
|
|
1252
1290
|
let index = 0;
|
|
1253
1291
|
const maxId = IntEncoder.decode(value.substr(index, BitLength.maxId), BitLength.maxId);
|
|
@@ -1256,7 +1294,7 @@ class VendorVectorEncoder {
|
|
|
1256
1294
|
index += BitLength.encodingType;
|
|
1257
1295
|
if (encodingType === VectorEncodingType.RANGE) {
|
|
1258
1296
|
vector = new Vector();
|
|
1259
|
-
if (
|
|
1297
|
+
if (version2 === 1) {
|
|
1260
1298
|
if (value.substr(index, 1) === "1") {
|
|
1261
1299
|
throw new DecodingError("Unable to decode default consent=1");
|
|
1262
1300
|
}
|
|
@@ -1721,12 +1759,12 @@ const _GVL = class _GVL extends Cloneable {
|
|
|
1721
1759
|
throw new GVLError("must specify GVL.baseUrl before loading GVL json");
|
|
1722
1760
|
}
|
|
1723
1761
|
if (versionOrVendorList > 0) {
|
|
1724
|
-
const
|
|
1725
|
-
if (_GVL.CACHE.has(
|
|
1726
|
-
this.populate(_GVL.CACHE.get(
|
|
1762
|
+
const version2 = versionOrVendorList;
|
|
1763
|
+
if (_GVL.CACHE.has(version2)) {
|
|
1764
|
+
this.populate(_GVL.CACHE.get(version2));
|
|
1727
1765
|
this.readyPromise = Promise.resolve();
|
|
1728
1766
|
} else {
|
|
1729
|
-
url += _GVL.versionedFilename.replace("[VERSION]", String(
|
|
1767
|
+
url += _GVL.versionedFilename.replace("[VERSION]", String(version2));
|
|
1730
1768
|
this.readyPromise = this.fetchJson(url);
|
|
1731
1769
|
}
|
|
1732
1770
|
} else {
|
|
@@ -2800,7 +2838,7 @@ async function saveConsent(consentEndpoint, payload) {
|
|
|
2800
2838
|
}
|
|
2801
2839
|
function consentReadyHandlerFn(props) {
|
|
2802
2840
|
const { userId, consentProxyHost, cookieDomain, formOfWordsId, useConsentStore } = props;
|
|
2803
|
-
return async function consentReadyHandler(legislation2,
|
|
2841
|
+
return async function consentReadyHandler(legislation2, _consentUUID, consentString, consentMeta) {
|
|
2804
2842
|
const activeLegislation = consentMeta.applies ? legislation2 : "gdpr";
|
|
2805
2843
|
if (activeLegislation !== legislation2 || !consentString) {
|
|
2806
2844
|
return;
|
|
@@ -2837,6 +2875,7 @@ async function initSourcepointCmp({
|
|
|
2837
2875
|
formOfWordsId = SOURCEPOINT_FOW_ID,
|
|
2838
2876
|
useConsentStore = true
|
|
2839
2877
|
} = {}) {
|
|
2878
|
+
var _a2;
|
|
2840
2879
|
if (!userId && useFTSession) {
|
|
2841
2880
|
try {
|
|
2842
2881
|
const response = await getUuid();
|
|
@@ -2851,70 +2890,23 @@ async function initSourcepointCmp({
|
|
|
2851
2890
|
if (userId) {
|
|
2852
2891
|
propertyConfig.authId = userId;
|
|
2853
2892
|
}
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
window._sp_queue.push(() => {
|
|
2857
|
-
window._sp_.addEventListener(
|
|
2858
|
-
"onConsentReady",
|
|
2859
|
-
consentReadyHandlerFn({
|
|
2860
|
-
userId,
|
|
2861
|
-
consentProxyHost,
|
|
2862
|
-
cookieDomain,
|
|
2863
|
-
formOfWordsId,
|
|
2864
|
-
useConsentStore
|
|
2865
|
-
})
|
|
2866
|
-
);
|
|
2867
|
-
});
|
|
2868
|
-
}
|
|
2869
|
-
const events = {
|
|
2870
|
-
onMessageChoiceSelect: (...args) => {
|
|
2871
|
-
console.log("[event] onMessageChoiceSelect", args);
|
|
2872
|
-
},
|
|
2873
|
-
onMessageReady: (...args) => {
|
|
2874
|
-
console.log("[event] onMessageReady", args);
|
|
2875
|
-
},
|
|
2876
|
-
onMessageChoiceError: (...args) => {
|
|
2877
|
-
console.log("[event] onMessageChoiceError", args);
|
|
2878
|
-
},
|
|
2879
|
-
onPrivacyManagerAction: (...args) => {
|
|
2880
|
-
console.log("[event] onPrivacyManagerAction", args);
|
|
2881
|
-
},
|
|
2882
|
-
onPMCancel: (...args) => {
|
|
2883
|
-
console.log("[event] onPMCancel", args);
|
|
2884
|
-
},
|
|
2885
|
-
onMessageReceiveData: (...args) => {
|
|
2886
|
-
console.log("[event] onMessageReceiveData", args);
|
|
2887
|
-
},
|
|
2888
|
-
onSPPMObjectReady: (...args) => {
|
|
2889
|
-
console.log("[event] onSPPMObjectReady", args);
|
|
2890
|
-
},
|
|
2891
|
-
onConsentReady: (...args) => {
|
|
2892
|
-
console.log("[event] onConsentReady", args);
|
|
2893
|
-
},
|
|
2894
|
-
onError: (...args) => {
|
|
2895
|
-
console.log("[event] onError", args);
|
|
2896
|
-
}
|
|
2897
|
-
};
|
|
2898
|
-
const debug = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2899
|
-
__proto__: null,
|
|
2900
|
-
events
|
|
2901
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2902
|
-
function updateFooterLinkCMP() {
|
|
2903
|
-
const cookieLink = document.querySelector(
|
|
2904
|
-
"[href='https://www.ft.com/preferences/manage-cookies']"
|
|
2905
|
-
);
|
|
2906
|
-
if (cookieLink) {
|
|
2907
|
-
cookieLink.href = "#";
|
|
2908
|
-
cookieLink.setAttribute("onclick", "window._sp_.gdpr.loadPrivacyManagerModal(827767);");
|
|
2909
|
-
cookieLink.dataset.cmpLink = "updated";
|
|
2910
|
-
return true;
|
|
2911
|
-
} else {
|
|
2912
|
-
console.warn("CMP Footer Link was not found and not updated");
|
|
2913
|
-
return false;
|
|
2893
|
+
if ((_a2 = propertyConfig.events) == null ? void 0 : _a2.onConsentReady) {
|
|
2894
|
+
console.warn("[cmp-client] The supplied 'onConsentReady' event handler will be overwritten.");
|
|
2914
2895
|
}
|
|
2896
|
+
const events2 = {
|
|
2897
|
+
...propertyConfig.events ?? {},
|
|
2898
|
+
onConsentReady: consentReadyHandlerFn({
|
|
2899
|
+
userId,
|
|
2900
|
+
consentProxyHost,
|
|
2901
|
+
cookieDomain,
|
|
2902
|
+
formOfWordsId,
|
|
2903
|
+
useConsentStore
|
|
2904
|
+
})
|
|
2905
|
+
};
|
|
2906
|
+
bootstrapCmp({ ...propertyConfig, events: events2 });
|
|
2915
2907
|
}
|
|
2908
|
+
window.FT_CMP_CLIENT_VERSION = version;
|
|
2916
2909
|
exports.debug = debug;
|
|
2917
|
-
exports.getCmpScripts = getCmpScripts;
|
|
2918
2910
|
exports.initSourcepointCmp = initSourcepointCmp;
|
|
2919
2911
|
exports.properties = properties;
|
|
2920
2912
|
exports.updateFooterLinkCMP = updateFooterLinkCMP;
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,87 @@ 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 = "2.2.3-alpha";
|
|
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 properties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
71
|
+
__proto__: null,
|
|
72
|
+
FT_DOTCOM_PROD,
|
|
73
|
+
FT_DOTCOM_TEST
|
|
74
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
75
|
+
function updateFooterLinkCMP() {
|
|
76
|
+
const cookieLink = document.querySelector(
|
|
77
|
+
"[href='https://www.ft.com/preferences/manage-cookies']"
|
|
78
|
+
);
|
|
79
|
+
if (cookieLink) {
|
|
80
|
+
cookieLink.href = "#";
|
|
81
|
+
cookieLink.setAttribute("onclick", "window._sp_.gdpr.loadPrivacyManagerModal(827767);");
|
|
82
|
+
cookieLink.dataset.cmpLink = "updated";
|
|
83
|
+
return true;
|
|
84
|
+
} else {
|
|
85
|
+
console.warn("CMP Footer Link was not found and not updated");
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
8
89
|
const request = (url, { credentials = "omit" } = {}) => {
|
|
9
90
|
return fetch(`https://session-next.ft.com${url}`, {
|
|
10
91
|
credentials,
|
|
@@ -111,30 +192,9 @@ const iabCustomCategories = {
|
|
|
111
192
|
specialFeatures: []
|
|
112
193
|
}
|
|
113
194
|
};
|
|
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) {
|
|
195
|
+
function createContentScript(cmpScript, content) {
|
|
137
196
|
const s = document.createElement("script");
|
|
197
|
+
s.dataset.cmpScript = cmpScript;
|
|
138
198
|
s.innerHTML = content;
|
|
139
199
|
return s;
|
|
140
200
|
}
|
|
@@ -143,47 +203,25 @@ function createSourceScript(src) {
|
|
|
143
203
|
s.src = src;
|
|
144
204
|
return s;
|
|
145
205
|
}
|
|
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
206
|
const scriptSources = {
|
|
172
207
|
cmpFrames: "https://consent-manager.ft.com/unified/wrapperMessagingWithoutDetection.js"
|
|
173
208
|
};
|
|
174
209
|
const scriptContent = {
|
|
175
|
-
getSPConfig,
|
|
176
210
|
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
211
|
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
212
|
};
|
|
179
|
-
function getCmpScripts(
|
|
213
|
+
function getCmpScripts() {
|
|
180
214
|
const fragment = document.createDocumentFragment();
|
|
181
|
-
fragment.appendChild(createContentScript(scriptContent.tcfStub));
|
|
182
|
-
fragment.appendChild(createContentScript(scriptContent.uspStub));
|
|
183
|
-
fragment.appendChild(createContentScript(scriptContent.getSPConfig(config)));
|
|
215
|
+
fragment.appendChild(createContentScript("tcf", scriptContent.tcfStub));
|
|
216
|
+
fragment.appendChild(createContentScript("usp", scriptContent.uspStub));
|
|
184
217
|
fragment.appendChild(createSourceScript(scriptSources.cmpFrames));
|
|
185
218
|
return fragment;
|
|
186
219
|
}
|
|
220
|
+
function bootstrapCmp(config) {
|
|
221
|
+
window._sp_ = { config };
|
|
222
|
+
window._sp_queue ?? (window._sp_queue = []);
|
|
223
|
+
document.head.appendChild(getCmpScripts());
|
|
224
|
+
}
|
|
187
225
|
function getConsentPayload(parsedConsent, { shouldUpdateConsentStore, formOfWordsId, cookieDomain }) {
|
|
188
226
|
const categoryNames = Object.keys(parsedConsent);
|
|
189
227
|
const data = categoryNames.reduce(
|
|
@@ -1245,7 +1283,7 @@ class VendorVectorEncoder {
|
|
|
1245
1283
|
}
|
|
1246
1284
|
return retrString;
|
|
1247
1285
|
}
|
|
1248
|
-
static decode(value,
|
|
1286
|
+
static decode(value, version2) {
|
|
1249
1287
|
let vector;
|
|
1250
1288
|
let index = 0;
|
|
1251
1289
|
const maxId = IntEncoder.decode(value.substr(index, BitLength.maxId), BitLength.maxId);
|
|
@@ -1254,7 +1292,7 @@ class VendorVectorEncoder {
|
|
|
1254
1292
|
index += BitLength.encodingType;
|
|
1255
1293
|
if (encodingType === VectorEncodingType.RANGE) {
|
|
1256
1294
|
vector = new Vector();
|
|
1257
|
-
if (
|
|
1295
|
+
if (version2 === 1) {
|
|
1258
1296
|
if (value.substr(index, 1) === "1") {
|
|
1259
1297
|
throw new DecodingError("Unable to decode default consent=1");
|
|
1260
1298
|
}
|
|
@@ -1719,12 +1757,12 @@ const _GVL = class _GVL extends Cloneable {
|
|
|
1719
1757
|
throw new GVLError("must specify GVL.baseUrl before loading GVL json");
|
|
1720
1758
|
}
|
|
1721
1759
|
if (versionOrVendorList > 0) {
|
|
1722
|
-
const
|
|
1723
|
-
if (_GVL.CACHE.has(
|
|
1724
|
-
this.populate(_GVL.CACHE.get(
|
|
1760
|
+
const version2 = versionOrVendorList;
|
|
1761
|
+
if (_GVL.CACHE.has(version2)) {
|
|
1762
|
+
this.populate(_GVL.CACHE.get(version2));
|
|
1725
1763
|
this.readyPromise = Promise.resolve();
|
|
1726
1764
|
} else {
|
|
1727
|
-
url += _GVL.versionedFilename.replace("[VERSION]", String(
|
|
1765
|
+
url += _GVL.versionedFilename.replace("[VERSION]", String(version2));
|
|
1728
1766
|
this.readyPromise = this.fetchJson(url);
|
|
1729
1767
|
}
|
|
1730
1768
|
} else {
|
|
@@ -2798,7 +2836,7 @@ async function saveConsent(consentEndpoint, payload) {
|
|
|
2798
2836
|
}
|
|
2799
2837
|
function consentReadyHandlerFn(props) {
|
|
2800
2838
|
const { userId, consentProxyHost, cookieDomain, formOfWordsId, useConsentStore } = props;
|
|
2801
|
-
return async function consentReadyHandler(legislation2,
|
|
2839
|
+
return async function consentReadyHandler(legislation2, _consentUUID, consentString, consentMeta) {
|
|
2802
2840
|
const activeLegislation = consentMeta.applies ? legislation2 : "gdpr";
|
|
2803
2841
|
if (activeLegislation !== legislation2 || !consentString) {
|
|
2804
2842
|
return;
|
|
@@ -2835,6 +2873,7 @@ async function initSourcepointCmp({
|
|
|
2835
2873
|
formOfWordsId = SOURCEPOINT_FOW_ID,
|
|
2836
2874
|
useConsentStore = true
|
|
2837
2875
|
} = {}) {
|
|
2876
|
+
var _a2;
|
|
2838
2877
|
if (!userId && useFTSession) {
|
|
2839
2878
|
try {
|
|
2840
2879
|
const response = await getUuid();
|
|
@@ -2849,71 +2888,24 @@ async function initSourcepointCmp({
|
|
|
2849
2888
|
if (userId) {
|
|
2850
2889
|
propertyConfig.authId = userId;
|
|
2851
2890
|
}
|
|
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;
|
|
2891
|
+
if ((_a2 = propertyConfig.events) == null ? void 0 : _a2.onConsentReady) {
|
|
2892
|
+
console.warn("[cmp-client] The supplied 'onConsentReady' event handler will be overwritten.");
|
|
2912
2893
|
}
|
|
2894
|
+
const events2 = {
|
|
2895
|
+
...propertyConfig.events ?? {},
|
|
2896
|
+
onConsentReady: consentReadyHandlerFn({
|
|
2897
|
+
userId,
|
|
2898
|
+
consentProxyHost,
|
|
2899
|
+
cookieDomain,
|
|
2900
|
+
formOfWordsId,
|
|
2901
|
+
useConsentStore
|
|
2902
|
+
})
|
|
2903
|
+
};
|
|
2904
|
+
bootstrapCmp({ ...propertyConfig, events: events2 });
|
|
2913
2905
|
}
|
|
2906
|
+
window.FT_CMP_CLIENT_VERSION = version;
|
|
2914
2907
|
export {
|
|
2915
2908
|
debug,
|
|
2916
|
-
getCmpScripts,
|
|
2917
2909
|
initSourcepointCmp,
|
|
2918
2910
|
properties,
|
|
2919
2911
|
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,22 @@
|
|
|
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
|
+
//# 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"}
|
|
@@ -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"}
|
|
@@ -1 +0,0 @@
|
|
|
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,KAChB,MAAM,iBACM,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mBAoCrC"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-consent.test.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/__tests__/check-consent.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-parsed-consent.test.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/__tests__/get-parsed-consent.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.test.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/__tests__/validators.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cmp-footer-links.test.d.ts","sourceRoot":"","sources":["../../../src/html/__tests__/cmp-footer-links.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SPConfig } from "../../typings/types";
|
|
2
|
-
/**
|
|
3
|
-
* Utility method to string-encode an object including functions
|
|
4
|
-
*/
|
|
5
|
-
export declare function encodeConfig(obj: Record<string, string | object | null> | object | null): string;
|
|
6
|
-
export declare function getSPConfig(config: SPConfig): string;
|
|
7
|
-
export declare const scriptSources: {
|
|
8
|
-
cmpFrames: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const scriptContent: {
|
|
11
|
-
getSPConfig: typeof getSPConfig;
|
|
12
|
-
tcfStub: string;
|
|
13
|
-
uspStub: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function getCmpScripts(config: SPConfig): DocumentFragment;
|
|
16
|
-
//# sourceMappingURL=cmp-scripts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAIpD;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,UA2BvF;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,UAE3C;AAED,eAAO,MAAM,aAAa;;CAEzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;CAIzB,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,oBAQ7C"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/lib/debug.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const events: {
|
|
2
|
-
onMessageChoiceSelect: (...args: unknown[]) => void;
|
|
3
|
-
onMessageReady: (...args: unknown[]) => void;
|
|
4
|
-
onMessageChoiceError: (...args: unknown[]) => void;
|
|
5
|
-
onPrivacyManagerAction: (...args: unknown[]) => void;
|
|
6
|
-
onPMCancel: (...args: unknown[]) => void;
|
|
7
|
-
onMessageReceiveData: (...args: unknown[]) => void;
|
|
8
|
-
onSPPMObjectReady: (...args: unknown[]) => void;
|
|
9
|
-
onConsentReady: (...args: unknown[]) => void;
|
|
10
|
-
onError: (...args: unknown[]) => void;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=debug.d.ts.map
|
package/dist/lib/debug.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/lib/debug.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;qCACgB,OAAO,EAAE;8BAGhB,OAAO,EAAE;oCAGH,OAAO,EAAE;sCAGP,OAAO,EAAE;0BAGrB,OAAO,EAAE;oCAGC,OAAO,EAAE;iCAGZ,OAAO,EAAE;8BAGZ,OAAO,EAAE;uBAGhB,OAAO,EAAE;CAG7B,CAAC"}
|
package/dist/lib/properties.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const FT_DOTCOM_LOCAL: {
|
|
2
|
-
accountId: number;
|
|
3
|
-
baseEndpoint: string;
|
|
4
|
-
propertyHref: string;
|
|
5
|
-
joinHref: boolean;
|
|
6
|
-
gdpr: {};
|
|
7
|
-
ccpa: {};
|
|
8
|
-
};
|
|
9
|
-
export declare const FT_DOTCOM_PROD: {
|
|
10
|
-
accountId: number;
|
|
11
|
-
baseEndpoint: string;
|
|
12
|
-
propertyId: number;
|
|
13
|
-
joinHref: boolean;
|
|
14
|
-
gdpr: {};
|
|
15
|
-
ccpa: {};
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/lib/properties.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;;;;;CAK3B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CAK1B,CAAC"}
|
package/dist/utils/dom.d.ts
DELETED
package/dist/utils/dom.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,qBAIlD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,qBAI7C"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{consent-ready → src/consent-ready}/utils/__tests__/get-parsed-consent.test.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|