@financial-times/cmp-client 2.0.4-alpha → 2.0.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +3 -63
- package/dist/client.d.ts.map +1 -0
- package/dist/consent-ready/index.d.ts +5 -0
- package/dist/consent-ready/index.d.ts.map +1 -0
- package/dist/consent-ready/utils/__fixtures__/strings.d.ts +9 -0
- package/dist/consent-ready/utils/__fixtures__/strings.d.ts.map +1 -0
- package/dist/consent-ready/utils/__tests__/check-consent.test.d.ts +2 -0
- package/dist/consent-ready/utils/__tests__/check-consent.test.d.ts.map +1 -0
- package/dist/consent-ready/utils/__tests__/get-parsed-consent.test.d.ts +2 -0
- package/dist/consent-ready/utils/__tests__/get-parsed-consent.test.d.ts.map +1 -0
- package/dist/consent-ready/utils/__tests__/validators.test.d.ts +2 -0
- package/dist/consent-ready/utils/__tests__/validators.test.d.ts.map +1 -0
- package/dist/consent-ready/utils/get-consent-payload.d.ts +18 -0
- package/dist/consent-ready/utils/get-consent-payload.d.ts.map +1 -0
- package/dist/consent-ready/utils/get-parsed-consent.d.ts +14 -0
- package/dist/consent-ready/utils/get-parsed-consent.d.ts.map +1 -0
- package/dist/consent-ready/utils/has-consent-changed.d.ts +3 -0
- package/dist/consent-ready/utils/has-consent-changed.d.ts.map +1 -0
- package/dist/consent-ready/utils/validators.d.ts +16 -0
- package/dist/consent-ready/utils/validators.d.ts.map +1 -0
- package/dist/html/__tests__/cmp-footer-links.test.d.ts +2 -0
- package/dist/html/__tests__/cmp-footer-links.test.d.ts.map +1 -0
- package/dist/html/cmp-footer-link.d.ts +8 -0
- package/dist/html/cmp-footer-link.d.ts.map +1 -0
- package/dist/html/cmp-scripts.d.ts +16 -0
- package/dist/html/cmp-scripts.d.ts.map +1 -0
- package/dist/{client.cjs → index.cjs} +409 -158
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/{client.js → index.js} +408 -157
- package/dist/lib/constants.d.ts +13 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/{debug.d.ts → lib/debug.d.ts} +12 -13
- package/dist/lib/debug.d.ts.map +1 -0
- package/dist/{properties.d.ts → lib/properties.d.ts} +17 -19
- package/dist/lib/properties.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +3 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/package.json +20 -30
- package/typings/globals.d.ts +20 -0
- package/typings/modules.d.ts +1 -0
- package/typings/types.d.ts +88 -0
- package/dist/debug.cjs +0 -32
- package/dist/debug.js +0 -32
- package/dist/properties.cjs +0 -21
- package/dist/properties.js +0 -21
package/dist/client.d.ts
CHANGED
|
@@ -1,63 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
propertyConfig: SPConfig;
|
|
5
|
-
userId?: string;
|
|
6
|
-
useFTSession: boolean;
|
|
7
|
-
consentProxyHost: string;
|
|
8
|
-
cookieDomain: string;
|
|
9
|
-
formOfWordsId: string;
|
|
10
|
-
useConsentStore: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare const events = {
|
|
14
|
-
onMessageChoiceSelect: declare function (...args: unknown[]) {
|
|
15
|
-
console.log("[event] onMessageChoiceSelect", args);
|
|
16
|
-
},
|
|
17
|
-
onMessageReady: declare function (...args: unknown[]) {
|
|
18
|
-
console.log("[event] onMessageReady", args);
|
|
19
|
-
},
|
|
20
|
-
onMessageChoiceError: declare function (...args: unknown[]) {
|
|
21
|
-
console.log("[event] onMessageChoiceError", args);
|
|
22
|
-
},
|
|
23
|
-
onPrivacyManagerAction: declare function (...args: unknown[]) {
|
|
24
|
-
console.log("[event] onPrivacyManagerAction", args);
|
|
25
|
-
},
|
|
26
|
-
onPMCancel: declare function (...args: unknown[]) {
|
|
27
|
-
console.log("[event] onPMCancel", args);
|
|
28
|
-
},
|
|
29
|
-
onMessageReceiveData: declare function (...args: unknown[]) {
|
|
30
|
-
console.log("[event] onMessageReceiveData", args);
|
|
31
|
-
},
|
|
32
|
-
onSPPMObjectReady: declare function (...args: unknown[]) {
|
|
33
|
-
console.log("[event] onSPPMObjectReady", args);
|
|
34
|
-
},
|
|
35
|
-
onConsentReady: declare function (...args: unknown[]) {
|
|
36
|
-
console.log("[event] onConsentReady", args);
|
|
37
|
-
},
|
|
38
|
-
onError: declare function (...args: unknown[]) {
|
|
39
|
-
console.log("[event] onError", args);
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export declare function getCmpScripts(config: SPConfig): DocumentFragment;
|
|
44
|
-
|
|
45
|
-
export declare function initSourcepointCmp({ propertyConfig, userId, useFTSession, consentProxyHost, cookieDomain, formOfWordsId, useConsentStore, }: CMPInitOptions): Promise<void>;
|
|
46
|
-
|
|
47
|
-
declare interface SPConfig {
|
|
48
|
-
accountId: number;
|
|
49
|
-
baseEndpoint: string;
|
|
50
|
-
gdpr: Record<string, unknown>;
|
|
51
|
-
ccpa: Record<string, unknown>;
|
|
52
|
-
propertyHref?: string;
|
|
53
|
-
propertyId?: string;
|
|
54
|
-
joinHref?: boolean;
|
|
55
|
-
events?: SPLifecycleEvents;
|
|
56
|
-
authId?: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
declare type SPLifecycleEvents = Partial<typeof events>;
|
|
60
|
-
|
|
61
|
-
export { updateFooterLinkCMP }
|
|
62
|
-
|
|
63
|
-
export { }
|
|
1
|
+
import type { CMPInitOptions } from "../typings/types.d.ts";
|
|
2
|
+
export declare function initSourcepointCmp({ propertyConfig, userId, useFTSession, consentProxyHost, cookieDomain, formOfWordsId, useConsentStore, }: CMPInitOptions): Promise<void>;
|
|
3
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -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,EAAE,cAAc,iBAiChB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ConsentReadyProps } from "../../typings/types.d.ts";
|
|
2
|
+
export declare function consentReadyHandlerFn(props: ConsentReadyProps): (legislation: string, _: string, consentString: string, consentMeta: {
|
|
3
|
+
applies?: boolean;
|
|
4
|
+
}) => Promise<void>;
|
|
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,KAChB,MAAM,iBACM,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mBAoCrC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const validTCStringNoConsent = "CPzIxKcPzIxKcFNAAAENCZCAAAAAAAAAAAAAAAAAAAAA.II7Nd_X__bX9n-_7_6ft0eY1f9_r37uQzDhfNs-8F3L_W_LwX32E7NF36tq4KmR4ku1bBIQNtHMnUDUmxaolVrzHsak2cpyNKJ_JkknsZe2dYGF9Pn9lD-YKZ7_5_9_f52T_9_9_-39z3_9f___dv_-__-vjf_599n_v9fV_78_Kf9______-____________8A";
|
|
2
|
+
/**
|
|
3
|
+
* Purposes 1, 5 & 6
|
|
4
|
+
*/
|
|
5
|
+
export declare const validTCStringPartialConsent = "CPy5ZPbPy5ZPbEsACAENCZCAAIwAAAAAAAwIAAAAAAAA.II7Nd_X__bX9n-_7_6ft0eY1f9_r37uQzDhfNs-8F3L_W_LwX32E7NF36tq4KmR4ku1bBIQNtHMnUDUmxaolVrzHsak2cpyNKJ_JkknsZe2dYGF9Pn9lD-YKZ7_5_9_f52T_9_9_-39z3_9f___dv_-__-vjf_599n_v9fV_78_Kf9______-____________8A";
|
|
6
|
+
export declare const validTCStringFullConsent = "CPyTwm7PyTwm7EsAAAENCZCMAP_AAAAAAAwII7Nd_X__bX9n-_7_6ft0eY1f9_r37uQzDhfNs-8F3L_W_LwX32E7NF36tq4KmR4ku1bBIQNtHMnUDUmxaolVrzHsak2cpyNKJ_JkknsZe2dYGF9Pn9lD-YKZ7_5_9_f52T_9_9_-39z3_9f___dv_-__-vjf_599n_v9fV_78_Kf9______-____________8AAAAAA.II7Nd_X__bX9n-_7_6ft0eY1f9_r37uQzDhfNs-8F3L_W_LwX32E7NF36tq4KmR4ku1bBIQNtHMnUDUmxaolVrzHsak2cpyNKJ_JkknsZe2dYGF9Pn9lD-YKZ7_5_9_f52T_9_9_-39z3_9f___dv_-__-vjf_599n_v9fV_78_Kf9______-____________8A";
|
|
7
|
+
export declare const uspStringFullConsent = "1YNN";
|
|
8
|
+
export declare const uspStringNoConsent = "1YYN";
|
|
9
|
+
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -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,18 @@
|
|
|
1
|
+
import type { ParsedConsentState, ConsentPayloadOptions, ConsentCategoryPayload } from "../../../typings/types";
|
|
2
|
+
/**
|
|
3
|
+
* Build payload for updating user's consent
|
|
4
|
+
*/
|
|
5
|
+
export declare function getConsentPayload(parsedConsent: ParsedConsentState, { shouldUpdateConsentStore, formOfWordsId, cookieDomain }: Partial<ConsentPayloadOptions>): {
|
|
6
|
+
data: Record<string, ConsentCategoryPayload>;
|
|
7
|
+
setConsentCookie?: undefined;
|
|
8
|
+
formOfWordsId?: undefined;
|
|
9
|
+
consentSource?: undefined;
|
|
10
|
+
cookieDomain?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
setConsentCookie: boolean;
|
|
13
|
+
formOfWordsId: string | undefined;
|
|
14
|
+
consentSource: string;
|
|
15
|
+
cookieDomain: string | undefined;
|
|
16
|
+
data: Record<string, ConsentCategoryPayload>;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=get-consent-payload.d.ts.map
|
|
@@ -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,14 @@
|
|
|
1
|
+
import type { RawConsentState, ParsedConsentState } from "../../../typings/types.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Checks the consent for a specific custom purpose.
|
|
4
|
+
* @param categoryName - The custom IAB category identifier to check.
|
|
5
|
+
* @param consentState - The consent state to use for checking.
|
|
6
|
+
* @returns {boolean} - Returns true if consent is granted, otherwise false.
|
|
7
|
+
*/
|
|
8
|
+
export declare function checkConsentFor(categoryName: string, consentState: RawConsentState): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* This function returns a pre-processed consent state of the user
|
|
11
|
+
* The returned object is a dictionary of custom purposes and their boolean on/off values
|
|
12
|
+
*/
|
|
13
|
+
export declare function getParsedConsent(rawConsentState: RawConsentState): ParsedConsentState;
|
|
14
|
+
//# sourceMappingURL=get-parsed-consent.d.ts.map
|
|
@@ -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,16 @@
|
|
|
1
|
+
import type { RawConsentState } from "../../../typings/types";
|
|
2
|
+
export declare function isValidGdprValue(val: string | null): boolean;
|
|
3
|
+
export declare function isValidUspString(val: string | null): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Validates consent state.
|
|
6
|
+
* @param input - The consent state to validate.
|
|
7
|
+
* @throws Will throw an error if the consent state is invalid.
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateRawConsentState(input: RawConsentState): input is RawConsentState;
|
|
10
|
+
/**
|
|
11
|
+
* Validates the custom purpose identifier.
|
|
12
|
+
* @param categoryName - The custom purpose identifier to validate.
|
|
13
|
+
* @throws Will throw an error if the custom purpose identifier is invalid.
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateIabConsentCategory(categoryName: string): void;
|
|
16
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -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,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs a querySelector to get a reference to the Manage Gookies link anchor-tag element if
|
|
3
|
+
* it exists in the page DOM. It then adds an onClick function to the link
|
|
4
|
+
|
|
5
|
+
* @returns {boolean} - Returns true if the link was updated, false if not
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateFooterLinkCMP(): boolean;
|
|
8
|
+
//# sourceMappingURL=cmp-footer-link.d.ts.map
|
|
@@ -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,16 @@
|
|
|
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
|
|
@@ -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;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"}
|