@financial-times/cmp-client 0.0.0-beta.1
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 +195 -0
- package/dist/index.cjs +2993 -0
- package/dist/index.js +2993 -0
- package/dist/src/client.d.ts +3 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/consent-ready/index.d.ts +5 -0
- package/dist/src/consent-ready/index.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/__fixtures__/strings.d.ts +9 -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 +2 -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 +2 -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 +2 -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 +18 -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 +14 -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 +3 -0
- package/dist/src/consent-ready/utils/has-consent-changed.d.ts.map +1 -0
- package/dist/src/consent-ready/utils/validators.d.ts +16 -0
- package/dist/src/consent-ready/utils/validators.d.ts.map +1 -0
- package/dist/src/html/__tests__/cmp-footer-links.test.d.ts +2 -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 +8 -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/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/constants.d.ts +13 -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 +40 -0
- package/typings/globals.d.ts +12 -0
- package/typings/modules.d.ts +1 -0
- package/typings/types.d.ts +98 -0
|
@@ -0,0 +1,3 @@
|
|
|
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,GAAE,cAAmB,iBA+CrB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ConsentReadyProps } from "../../typings/types.d.ts";
|
|
2
|
+
export declare function consentReadyHandlerFn(props: ConsentReadyProps): (legislation: string, _consentUUID: 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,gBACL,MAAM,iBACL,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
|
+
cookieDomain: string | undefined;
|
|
8
|
+
setConsentCookie?: undefined;
|
|
9
|
+
formOfWordsId?: undefined;
|
|
10
|
+
consentSource?: 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 @@
|
|
|
1
|
+
{"version":3,"file":"cmp-scripts.test.d.ts","sourceRoot":"","sources":["../../../../src/html/__tests__/cmp-scripts.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,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,QAO5C"}
|
|
@@ -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,13 @@
|
|
|
1
|
+
import type { IabCustomCategory } from "../../typings/types.d.ts";
|
|
2
|
+
export declare const SOURCEPOINT_CONSENT_SOURCE = "sourcepoint-cmp";
|
|
3
|
+
export declare const SOURCEPOINT_FOW_SCOPE = "FTPINK";
|
|
4
|
+
export declare const CONSENT_COOKIE_NAME = "FTConsent";
|
|
5
|
+
export declare const SOURCEPOINT_FOW_ID = "sourcepointCmp/VngD.XycZut.595cp9fWdp5XYP9vlFvk";
|
|
6
|
+
export declare const FT_COOKIE_DOMAIN = ".ft.com";
|
|
7
|
+
export declare const FT_CONSENT_PROXY_HOST = "https://consent.ft.com";
|
|
8
|
+
export declare const legislation: {
|
|
9
|
+
CCPA: string;
|
|
10
|
+
GDPR: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const iabCustomCategories: Record<string, IabCustomCategory>;
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -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;8BAOZ,KAAK;oCAGC,KAAK;sCAGH,KAAK;0BAOjB,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;;;;;;;CAM1B,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
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@financial-times/cmp-client",
|
|
3
|
+
"version": "0.0.0-beta.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"typings"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@iabtechlabtcf/core": "^1.5.10",
|
|
20
|
+
"next-session-client": "^5.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"eslint": "^8.53.0",
|
|
24
|
+
"npm-run-all": "^4.1.5",
|
|
25
|
+
"typescript": "^5.2.2",
|
|
26
|
+
"vite": "^4.5.0",
|
|
27
|
+
"vitest": "^0.34.6"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint ./src ./typings --ext .ts",
|
|
31
|
+
"checks:lint": "npm run lint",
|
|
32
|
+
"checks:unit": "npm t -- --run",
|
|
33
|
+
"checks:types": "tsc",
|
|
34
|
+
"checks": "run-s checks:*",
|
|
35
|
+
"build:lib": "vite build",
|
|
36
|
+
"build:types": "tsc",
|
|
37
|
+
"build": "run-s build:*",
|
|
38
|
+
"test": "vitest"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "next-session-client";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { events } from "../src/lib/debug.ts";
|
|
2
|
+
|
|
3
|
+
import { iabCustomCategories } from "../src/lib/constants.ts";
|
|
4
|
+
|
|
5
|
+
export type SPLifecycleEvents = Partial<typeof events>;
|
|
6
|
+
|
|
7
|
+
export type SPEventId = keyof SPLifecycleEvents;
|
|
8
|
+
|
|
9
|
+
export interface SPConfig {
|
|
10
|
+
accountId: number;
|
|
11
|
+
baseEndpoint: string;
|
|
12
|
+
gdpr: Record<string, unknown>;
|
|
13
|
+
ccpa: Record<string, unknown>;
|
|
14
|
+
propertyHref?: string;
|
|
15
|
+
propertyId?: number;
|
|
16
|
+
joinHref?: boolean;
|
|
17
|
+
events?: Partial<SPLifecycleEvents>;
|
|
18
|
+
authId?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type SPEventCallback = (
|
|
22
|
+
legislation: string,
|
|
23
|
+
_: string,
|
|
24
|
+
consentString: string,
|
|
25
|
+
consentMeta: Record<string, unknown>,
|
|
26
|
+
) => Promise<void>;
|
|
27
|
+
|
|
28
|
+
export type CMPInitOptions = Partial<{
|
|
29
|
+
propertyConfig: SPConfig;
|
|
30
|
+
userId?: string;
|
|
31
|
+
useFTSession: boolean;
|
|
32
|
+
consentProxyHost: string;
|
|
33
|
+
cookieDomain: string;
|
|
34
|
+
formOfWordsId: string;
|
|
35
|
+
useConsentStore: boolean;
|
|
36
|
+
spEventHandlers: [eventId: SPEventId, eventHandler: SPEventCallback][];
|
|
37
|
+
}>;
|
|
38
|
+
|
|
39
|
+
export interface ConsentPayloadOptions {
|
|
40
|
+
shouldUpdateConsentStore: boolean;
|
|
41
|
+
formOfWordsId: string;
|
|
42
|
+
cookieDomain: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ConsentCategoryPayload {
|
|
46
|
+
onsite: {
|
|
47
|
+
status: boolean;
|
|
48
|
+
lbi: false;
|
|
49
|
+
source: "sourcepoint-cmp";
|
|
50
|
+
fow?: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type ConsentReadyProps = Omit<CMPInitOptions, "propertyConfig" | "useFTSession">;
|
|
55
|
+
|
|
56
|
+
export interface ConsentPayloadOptions {
|
|
57
|
+
shouldUpdateConsentStore: boolean;
|
|
58
|
+
formOfWordsId: string;
|
|
59
|
+
cookieDomain: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ConsentCategoryPayload {
|
|
63
|
+
onsite: {
|
|
64
|
+
status: boolean;
|
|
65
|
+
lbi: false;
|
|
66
|
+
source: "sourcepoint-cmp";
|
|
67
|
+
fow?: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface IabCustomCategory {
|
|
72
|
+
purposes: number[];
|
|
73
|
+
iabVendors: number[];
|
|
74
|
+
customVendors: number[];
|
|
75
|
+
specialFeatures: number[];
|
|
76
|
+
fowId?: string;
|
|
77
|
+
isLbi?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type IabCustomCategoryName = keyof typeof iabCustomCategories;
|
|
81
|
+
|
|
82
|
+
export type Legislation = "gdpr" | "ccpa";
|
|
83
|
+
|
|
84
|
+
export interface RawConsentState {
|
|
85
|
+
gdpr: string | null;
|
|
86
|
+
ccpa: string | null;
|
|
87
|
+
activeLegislation: Legislation;
|
|
88
|
+
tcfCustomVendors?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type IabCustomCategories = Record<IabCustomCategoryName, IabCustomCategory>;
|
|
92
|
+
|
|
93
|
+
export type ParsedConsentState = Record<IabCustomCategoryName, boolean>;
|
|
94
|
+
|
|
95
|
+
export interface ConsentState {
|
|
96
|
+
raw: RawConsentState;
|
|
97
|
+
parsed: ParsedConsentState;
|
|
98
|
+
}
|