@financial-times/cmp-client 3.1.2 → 3.1.4
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 +41 -6
- package/dist/index.cjs +6 -2
- package/dist/index.js +6 -2
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,21 +21,56 @@ npm install @financial-times/cmp-client
|
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
|
+
> [!Note]
|
|
25
|
+
> We will be adding new properties (i.e. websites under FT group) and their configs as we start rolling out.
|
|
26
|
+
>
|
|
27
|
+
> Please reach out to the Ads & Privacy team if you think your domain needs a new property config
|
|
28
|
+
|
|
29
|
+
### Usage on non-FT.com properties
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { initSourcepointCmp, properties, debug } from "@financial-times/cmp-client";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Optionally enable debug mode to see CMP events in the console
|
|
36
|
+
*/
|
|
37
|
+
debug.logCmpEvents();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Import your domain's CMP configuration from the `properties` module:
|
|
41
|
+
* e.g. properties.MM_IGNITES_ASIA, properties.SP_THE_BANKER, etc.
|
|
42
|
+
*
|
|
43
|
+
* We will add more domains as we create new properties in Sourcepoint
|
|
44
|
+
*
|
|
45
|
+
* See below for the full list of initialisation options
|
|
46
|
+
*/
|
|
47
|
+
initSourcepointCmp({
|
|
48
|
+
propertyConfig: properties["YOUR_PROPERTY_CONFIG_KEY"],
|
|
49
|
+
useConsentStore: false, // Specialist Titles _must_ opt out of Single Consent Store
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Usage on FT.com
|
|
54
|
+
|
|
24
55
|
```js
|
|
25
|
-
import { initSourcepointCmp } from "@financial-times/cmp-client
|
|
26
|
-
import { FT_DOTCOM_TEST } from "@financial-times/cmp-client/properties";
|
|
56
|
+
import { initSourcepointCmp, properties, debug } from "@financial-times/cmp-client";
|
|
27
57
|
|
|
28
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Optionally enable debug mode to see CMP events in the console
|
|
60
|
+
*/
|
|
61
|
+
debug.logCmpEvents();
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* We suggest using a feature flag to disable the existing cookie banner
|
|
65
|
+
* and enable the new one
|
|
66
|
+
*/
|
|
29
67
|
if (flagsClient.get("adsDisableInternalCMP")) {
|
|
30
68
|
initSourcepointCmp({
|
|
31
69
|
propertyConfig: FT_DOTCOM_TEST,
|
|
32
|
-
// useConsentStore: false (set to false for non-FT.com properties or websites)
|
|
33
70
|
});
|
|
34
71
|
}
|
|
35
72
|
```
|
|
36
73
|
|
|
37
|
-
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.
|
|
38
|
-
|
|
39
74
|
### CMP configuration options:
|
|
40
75
|
|
|
41
76
|
<table>
|
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ 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 = "3.1.2";
|
|
11
10
|
const events = {
|
|
12
11
|
onMessageChoiceSelect: (...args) => {
|
|
13
12
|
console.log("[debug] onMessageChoiceSelect", args);
|
|
@@ -3135,6 +3134,7 @@ const trackingEventHandlers = {
|
|
|
3135
3134
|
});
|
|
3136
3135
|
}
|
|
3137
3136
|
};
|
|
3137
|
+
const version = "3.1.4";
|
|
3138
3138
|
async function initSourcepointCmp({
|
|
3139
3139
|
propertyConfig = FT_DOTCOM_PROD,
|
|
3140
3140
|
userId,
|
|
@@ -3145,6 +3145,11 @@ async function initSourcepointCmp({
|
|
|
3145
3145
|
useConsentStore = true,
|
|
3146
3146
|
trackingContext = {}
|
|
3147
3147
|
} = {}) {
|
|
3148
|
+
if (typeof window === "undefined") {
|
|
3149
|
+
console.error("The CMP client can only be initialised in a browser context");
|
|
3150
|
+
return;
|
|
3151
|
+
}
|
|
3152
|
+
window.FT_CMP_CLIENT_VERSION = version;
|
|
3148
3153
|
if (!userId && useFTSession) {
|
|
3149
3154
|
try {
|
|
3150
3155
|
const response = await getUuid();
|
|
@@ -3182,7 +3187,6 @@ async function initSourcepointCmp({
|
|
|
3182
3187
|
});
|
|
3183
3188
|
initTracking(trackingContext);
|
|
3184
3189
|
}
|
|
3185
|
-
window.FT_CMP_CLIENT_VERSION = version;
|
|
3186
3190
|
exports.debug = debug;
|
|
3187
3191
|
exports.initSourcepointCmp = initSourcepointCmp;
|
|
3188
3192
|
exports.properties = properties;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ 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.1.2";
|
|
9
8
|
const events = {
|
|
10
9
|
onMessageChoiceSelect: (...args) => {
|
|
11
10
|
console.log("[debug] onMessageChoiceSelect", args);
|
|
@@ -3133,6 +3132,7 @@ const trackingEventHandlers = {
|
|
|
3133
3132
|
});
|
|
3134
3133
|
}
|
|
3135
3134
|
};
|
|
3135
|
+
const version = "3.1.4";
|
|
3136
3136
|
async function initSourcepointCmp({
|
|
3137
3137
|
propertyConfig = FT_DOTCOM_PROD,
|
|
3138
3138
|
userId,
|
|
@@ -3143,6 +3143,11 @@ async function initSourcepointCmp({
|
|
|
3143
3143
|
useConsentStore = true,
|
|
3144
3144
|
trackingContext = {}
|
|
3145
3145
|
} = {}) {
|
|
3146
|
+
if (typeof window === "undefined") {
|
|
3147
|
+
console.error("The CMP client can only be initialised in a browser context");
|
|
3148
|
+
return;
|
|
3149
|
+
}
|
|
3150
|
+
window.FT_CMP_CLIENT_VERSION = version;
|
|
3146
3151
|
if (!userId && useFTSession) {
|
|
3147
3152
|
try {
|
|
3148
3153
|
const response = await getUuid();
|
|
@@ -3180,7 +3185,6 @@ async function initSourcepointCmp({
|
|
|
3180
3185
|
});
|
|
3181
3186
|
initTracking(trackingContext);
|
|
3182
3187
|
}
|
|
3183
|
-
window.FT_CMP_CLIENT_VERSION = version;
|
|
3184
3188
|
export {
|
|
3185
3189
|
debug,
|
|
3186
3190
|
initSourcepointCmp,
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAW5D,wBAAsB,kBAAkB,CAAC,EACvC,cAA+B,EAC/B,MAAM,EACN,YAAmB,EACnB,gBAAwC,EACxC,YAA+B,EAC/B,aAAkC,EAClC,eAAsB,EACtB,eAAoB,GACrB,GAAE,cAAmB,iBAgDrB"}
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,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"}
|