@financial-times/cmp-client 3.2.0 → 3.3.0-beta.5

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.
Files changed (50) hide show
  1. package/README.md +17 -2
  2. package/dist/cmp-static.js +660 -0
  3. package/dist/index.cjs +205 -2761
  4. package/dist/index.js +205 -2761
  5. package/dist/src/client.d.ts.map +1 -1
  6. package/dist/src/cmp-static.d.ts +2 -0
  7. package/dist/src/cmp-static.d.ts.map +1 -0
  8. package/dist/src/consent-ready/index.d.ts.map +1 -1
  9. package/dist/src/consent-ready/utils/__fixtures__/helpers.d.ts +27 -0
  10. package/dist/src/consent-ready/utils/__fixtures__/helpers.d.ts.map +1 -0
  11. package/dist/src/consent-ready/utils/__fixtures__/strings.d.ts +4 -8
  12. package/dist/src/consent-ready/utils/__fixtures__/strings.d.ts.map +1 -1
  13. package/dist/src/consent-ready/utils/__tests__/consent.test.d.ts +2 -0
  14. package/dist/src/consent-ready/utils/__tests__/consent.test.d.ts.map +1 -0
  15. package/dist/src/consent-ready/utils/consent.d.ts +6 -0
  16. package/dist/src/consent-ready/utils/consent.d.ts.map +1 -0
  17. package/dist/src/consent-ready/utils/get-consent-payload.d.ts +7 -7
  18. package/dist/src/consent-ready/utils/get-consent-payload.d.ts.map +1 -1
  19. package/dist/src/consent-ready/utils/get-parsed-consent.d.ts +6 -5
  20. package/dist/src/consent-ready/utils/get-parsed-consent.d.ts.map +1 -1
  21. package/dist/src/consent-ready/utils/validators.d.ts +0 -1
  22. package/dist/src/consent-ready/utils/validators.d.ts.map +1 -1
  23. package/dist/src/html/cmp-footer-link.d.ts +8 -4
  24. package/dist/src/html/cmp-footer-link.d.ts.map +1 -1
  25. package/dist/src/html/cmp-scripts.d.ts.map +1 -1
  26. package/dist/src/index.d.ts +1 -1
  27. package/dist/src/index.d.ts.map +1 -1
  28. package/dist/src/lib/constants.d.ts +33 -2
  29. package/dist/src/lib/constants.d.ts.map +1 -1
  30. package/dist/src/lib/properties.d.ts +36 -0
  31. package/dist/src/lib/properties.d.ts.map +1 -1
  32. package/dist/src/tracking/index.d.ts +1 -1
  33. package/dist/src/tracking/index.d.ts.map +1 -1
  34. package/dist/src/tracking/state.d.ts +6 -0
  35. package/dist/src/tracking/state.d.ts.map +1 -1
  36. package/dist/src/utils/__tests__/url.test.d.ts +2 -0
  37. package/dist/src/utils/__tests__/url.test.d.ts.map +1 -0
  38. package/dist/src/utils/url.d.ts +126 -0
  39. package/dist/src/utils/url.d.ts.map +1 -0
  40. package/package.json +11 -11
  41. package/typings/globals.d.ts +4 -0
  42. package/typings/types.d.ts +54 -4
  43. package/dist/src/consent-ready/utils/has-consent-changed.d.ts +0 -3
  44. package/dist/src/consent-ready/utils/has-consent-changed.d.ts.map +0 -1
  45. package/dist/src/html/__tests__/cmp-footer-links.test.d.ts +0 -2
  46. package/dist/src/html/__tests__/cmp-footer-links.test.d.ts.map +0 -1
  47. package/dist/src/lib/enableNonEssentialCookiesOption.d.ts +0 -2
  48. package/dist/src/lib/enableNonEssentialCookiesOption.d.ts.map +0 -1
  49. package/dist/src/utils/cookie.d.ts +0 -2
  50. package/dist/src/utils/cookie.d.ts.map +0 -1
@@ -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;AAY5D,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,iBAiDrB"}
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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cmp-static.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmp-static.d.ts","sourceRoot":"","sources":["../../src/cmp-static.ts"],"names":[],"mappings":""}
@@ -1 +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"}
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;AA8B/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,iBAE7C,MAAM,gBACL,MAAM,iBACL,MAAM,eACR;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,mBAsBrC"}
@@ -0,0 +1,27 @@
1
+ export declare function stubTCFAPI(consents: {
2
+ purpose: boolean;
3
+ vendor: boolean;
4
+ }): {
5
+ purpose: {
6
+ consents: {
7
+ "1": boolean;
8
+ "2": boolean;
9
+ "3": boolean;
10
+ "4": boolean;
11
+ "5": boolean;
12
+ "6": boolean;
13
+ "7": boolean;
14
+ "8": boolean;
15
+ "9": boolean;
16
+ "10": boolean;
17
+ };
18
+ legitimateInterests: {};
19
+ };
20
+ vendor: {
21
+ consents: {
22
+ 361: boolean;
23
+ };
24
+ legitimateInterests: {};
25
+ };
26
+ };
27
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/consent-ready/utils/__fixtures__/helpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,QAAQ,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;EA4BzE"}
@@ -1,9 +1,5 @@
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";
1
+ export declare const MOCK_USPAPI_CONSENT: {
2
+ readonly full: "1YNN";
3
+ readonly none: "1YYN";
4
+ };
9
5
  //# sourceMappingURL=strings.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../../../src/consent-ready/utils/__fixtures__/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=consent.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consent.test.d.ts","sourceRoot":"","sources":["../../../../../src/consent-ready/utils/__tests__/consent.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { ConsentReadyProps, ParsedConsentState } from "../../../typings/types";
2
+ export declare function getConsentCookieValue(): Record<string, boolean>;
3
+ export declare function hasConsentChanged(parsedConsent: ParsedConsentState, previousConsent: Record<string, boolean>): boolean;
4
+ export declare function shouldUpdateConsentStore({ userId, useConsentStore }: ConsentReadyProps): boolean;
5
+ export declare function getConsentEndpoint(updateConsentStore: boolean, props: ConsentReadyProps): string;
6
+ //# sourceMappingURL=consent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAIhC,wBAAgB,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAc/D;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,kBAAkB,EACjC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,OAAO,CAMT;AAED,wBAAgB,wBAAwB,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,iBAAiB,WAEtF;AAED,wBAAgB,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,UAMvF"}
@@ -2,17 +2,17 @@ import type { ParsedConsentState, ConsentPayloadOptions, ConsentCategoryPayload
2
2
  /**
3
3
  * Build payload for updating user's consent
4
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
- } | {
5
+ export declare function getConsentPayload(parsedConsent: ParsedConsentState, updateConsentStore: boolean, { formOfWordsId, cookieDomain }: Partial<ConsentPayloadOptions>): {
12
6
  setConsentCookie: boolean;
13
7
  formOfWordsId: string | undefined;
14
8
  consentSource: string;
15
9
  cookieDomain: string | undefined;
16
10
  data: Record<string, ConsentCategoryPayload>;
11
+ } | {
12
+ data: Record<string, ConsentCategoryPayload>;
13
+ cookieDomain: string | undefined;
14
+ setConsentCookie?: undefined;
15
+ formOfWordsId?: undefined;
16
+ consentSource?: undefined;
17
17
  };
18
18
  //# sourceMappingURL=get-consent-payload.d.ts.map
@@ -1 +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"}
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,EAEvB,MAAM,wBAAwB,CAAC;AAIhC;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,kBAAkB,EACjC,kBAAkB,EAAE,OAAO,EAC3B,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC;;;;;;;;;;;;EA6BhE"}
@@ -1,14 +1,15 @@
1
- import type { RawConsentState, ParsedConsentState } from "../../../typings/types.d.ts";
1
+ import type { TCData, ParsedConsentState, IabCustomCategoryName, Legislation } from "../../../typings/types";
2
2
  /**
3
3
  * Checks the consent for a specific custom purpose.
4
4
  * @param categoryName - The custom IAB category identifier to check.
5
5
  * @param consentState - The consent state to use for checking.
6
6
  * @returns {boolean} - Returns true if consent is granted, otherwise false.
7
7
  */
8
- export declare function checkConsentFor(categoryName: string, consentState: RawConsentState): boolean;
8
+ export declare function checkConsentFor(categoryName: IabCustomCategoryName, { purpose, vendor, specialFeatureOptins }: Partial<TCData>): boolean;
9
+ export declare function parseCCPAConsent(ccpa: string | null): ParsedConsentState;
10
+ export declare function parseGDPRConsent(): Promise<ParsedConsentState>;
9
11
  /**
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
+ * Return a dictionary of booleans keyed by IAB category name.
12
13
  */
13
- export declare function getParsedConsent(rawConsentState: RawConsentState): ParsedConsentState;
14
+ export declare function getParsedConsent(activeLegislation: Legislation, consentString: string): Promise<ParsedConsentState>;
14
15
  //# sourceMappingURL=get-parsed-consent.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"get-parsed-consent.d.ts","sourceRoot":"","sources":["../../../../src/consent-ready/utils/get-parsed-consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAIhC;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,qBAAqB,EACnC,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,GACzD,OAAO,CAiBT;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,sBAQnD;AAED,wBAAsB,gBAAgB,gCAerC;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,+BAE3F"}
@@ -1,5 +1,4 @@
1
1
  import type { RawConsentState } from "../../../typings/types";
2
- export declare function isValidGdprValue(val: string | null): boolean;
3
2
  export declare function isValidUspString(val: string | null): boolean;
4
3
  /**
5
4
  * Validates consent state.
@@ -1 +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"}
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;AAI9D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAO5D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,IAAI,eAAe,CAkBxF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAIrE"}
@@ -1,8 +1,12 @@
1
+ import type { SPConfig } from "../../typings/types.d.ts";
1
2
  /**
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
3
+ * Adds a "click" eventListener to the <footer> element
4
+ * checks the event.target.closest anchor tag and
5
+ * tests the anchor's href attribute against a target URL
6
+ * if the URL is matched, prevent default and call Sourcepoint
7
+ * loadPrivacyManagerModal function.
4
8
 
5
- * @returns {boolean} - Returns true if the link was updated, false if not
9
+ * @returns {void} - Returns true if the link was updated, false if not
6
10
  */
7
- export declare function updateFooterLinkCMP(): boolean;
11
+ export declare function updateFooterLinkCMP(propertyConfig?: SPConfig): void;
8
12
  //# sourceMappingURL=cmp-footer-link.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"cmp-footer-link.d.ts","sourceRoot":"","sources":["../../../src/html/cmp-footer-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,GAAE,QAAyB,GAAG,IAAI,CAgBnF"}
@@ -1 +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
+ {"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,QAM5C"}
@@ -1,5 +1,5 @@
1
1
  export * as debug from "./lib/debug.ts";
2
2
  export * as properties from "./lib/properties.ts";
3
3
  export { updateFooterLinkCMP } from "./html/cmp-footer-link.ts";
4
- export { initSourcepointCmp } from "./client";
4
+ export { initSourcepointCmp } from "./client.ts";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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,aAAa,CAAC"}
@@ -1,4 +1,3 @@
1
- import type { IabCustomCategory } from "../../typings/types.d.ts";
2
1
  export declare const SOURCEPOINT_CONSENT_SOURCE = "sourcepoint-cmp";
3
2
  export declare const SOURCEPOINT_FOW_SCOPE = "FTPINK";
4
3
  export declare const CONSENT_COOKIE_NAME = "FTConsent";
@@ -9,5 +8,37 @@ export declare const legislation: {
9
8
  CCPA: string;
10
9
  GDPR: string;
11
10
  };
12
- export declare const iabCustomCategories: Record<string, IabCustomCategory>;
11
+ export declare const iabCustomCategories: {
12
+ readonly permutiveAds: {
13
+ readonly purposes: readonly [2, 4, 8, 9];
14
+ readonly iabVendors: readonly [361];
15
+ readonly customVendors: readonly [];
16
+ readonly specialFeatures: readonly [];
17
+ };
18
+ readonly demographicAds: {
19
+ readonly purposes: readonly [3, 4, 7, 9, 10];
20
+ readonly iabVendors: readonly [];
21
+ readonly customVendors: readonly [];
22
+ readonly specialFeatures: readonly [];
23
+ };
24
+ readonly behaviouralAds: {
25
+ readonly purposes: readonly [2, 4, 8, 9];
26
+ readonly iabVendors: readonly [];
27
+ readonly customVendors: readonly [];
28
+ readonly specialFeatures: readonly [];
29
+ };
30
+ readonly programmaticAds: {
31
+ readonly purposes: readonly [2];
32
+ readonly iabVendors: readonly [];
33
+ readonly customVendors: readonly [];
34
+ readonly specialFeatures: readonly [];
35
+ };
36
+ readonly personalisedMarketing: {
37
+ readonly purposes: readonly [1, 4, 8, 9, 10];
38
+ readonly iabVendors: readonly [];
39
+ readonly customVendors: readonly [];
40
+ readonly specialFeatures: readonly [];
41
+ };
42
+ };
43
+ export declare const iabCategoryNames: ("permutiveAds" | "demographicAds" | "behaviouralAds" | "programmaticAds" | "personalisedMarketing")[];
13
44
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAEA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BtB,CAAC;AAEX,eAAO,MAAM,gBAAgB,wGAA8D,CAAC"}
@@ -7,6 +7,10 @@ export declare const FT_DOTCOM_TEST: {
7
7
  accountId: number;
8
8
  baseEndpoint: string;
9
9
  propertyHref: string;
10
+ _clientOptions: {
11
+ privacyManagerId: number;
12
+ manageCookiesLinkOverride: string;
13
+ };
10
14
  joinHref: boolean;
11
15
  gdpr: {};
12
16
  ccpa: {};
@@ -15,6 +19,11 @@ export declare const FT_DOTCOM_PROD: {
15
19
  accountId: number;
16
20
  baseEndpoint: string;
17
21
  propertyId: number;
22
+ _clientOptions: {
23
+ privacyManagerId: number;
24
+ manageCookiesLinkOverride: string;
25
+ rootDomain: string;
26
+ };
18
27
  joinHref: boolean;
19
28
  gdpr: {};
20
29
  ccpa: {};
@@ -23,6 +32,9 @@ export declare const SP_PWMNET: {
23
32
  accountId: number;
24
33
  baseEndpoint: string;
25
34
  propertyId: number;
35
+ _clientOptions: {
36
+ rootDomain: string;
37
+ };
26
38
  joinHref: boolean;
27
39
  gdpr: {};
28
40
  ccpa: {};
@@ -31,6 +43,9 @@ export declare const SP_FDI_INTELLIGENCE: {
31
43
  accountId: number;
32
44
  baseEndpoint: string;
33
45
  propertyId: number;
46
+ _clientOptions: {
47
+ rootDomain: string;
48
+ };
34
49
  joinHref: boolean;
35
50
  gdpr: {};
36
51
  ccpa: {};
@@ -39,6 +54,9 @@ export declare const SP_THE_BANKER: {
39
54
  accountId: number;
40
55
  baseEndpoint: string;
41
56
  propertyId: number;
57
+ _clientOptions: {
58
+ rootDomain: string;
59
+ };
42
60
  joinHref: boolean;
43
61
  gdpr: {};
44
62
  ccpa: {};
@@ -47,6 +65,9 @@ export declare const SP_BANKING_RR: {
47
65
  accountId: number;
48
66
  baseEndpoint: string;
49
67
  propertyId: number;
68
+ _clientOptions: {
69
+ rootDomain: string;
70
+ };
50
71
  joinHref: boolean;
51
72
  gdpr: {};
52
73
  ccpa: {};
@@ -55,6 +76,9 @@ export declare const SP_SUSTAINABLE_VIEWS: {
55
76
  accountId: number;
56
77
  baseEndpoint: string;
57
78
  propertyId: number;
79
+ _clientOptions: {
80
+ rootDomain: string;
81
+ };
58
82
  joinHref: boolean;
59
83
  gdpr: {};
60
84
  ccpa: {};
@@ -63,6 +87,9 @@ export declare const SP_FT_ADVISER: {
63
87
  accountId: number;
64
88
  baseEndpoint: string;
65
89
  propertyId: number;
90
+ _clientOptions: {
91
+ rootDomain: string;
92
+ };
66
93
  joinHref: boolean;
67
94
  gdpr: {};
68
95
  ccpa: {};
@@ -71,6 +98,9 @@ export declare const SP_INVESTORS_CHRONICLE: {
71
98
  accountId: number;
72
99
  baseEndpoint: string;
73
100
  propertyId: number;
101
+ _clientOptions: {
102
+ rootDomain: string;
103
+ };
74
104
  joinHref: boolean;
75
105
  gdpr: {};
76
106
  ccpa: {};
@@ -79,6 +109,9 @@ export declare const MM_IGNITES_ASIA: {
79
109
  accountId: number;
80
110
  baseEndpoint: string;
81
111
  propertyId: number;
112
+ _clientOptions: {
113
+ rootDomain: string;
114
+ };
82
115
  joinHref: boolean;
83
116
  gdpr: {};
84
117
  ccpa: {};
@@ -87,6 +120,9 @@ export declare const MM_IGNITES_EUROPE: {
87
120
  accountId: number;
88
121
  baseEndpoint: string;
89
122
  propertyId: number;
123
+ _clientOptions: {
124
+ rootDomain: string;
125
+ };
90
126
  joinHref: boolean;
91
127
  gdpr: {};
92
128
  ccpa: {};
@@ -1 +1 @@
1
- {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/lib/properties.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;CAK1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CAK1B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;CAK/B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;CAKhC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAKlC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;CAK3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;CAK7B,CAAC"}
1
+ {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/lib/properties.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAS1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;CAU1B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;CAQrB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAQ/B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;CAQhC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;CAQlC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;CAQ3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;CAQ7B,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { TrackingContext } from "../../typings/types.d.ts";
2
- export declare function initTracking(context: TrackingContext): void;
2
+ export declare function initTracking(context: TrackingContext, cmpBaseEndpoint: string): void;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tracking/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,eAAe,EAEhB,MAAM,0BAA0B,CAAC;AAUlC,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,QASpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tracking/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,eAAe,EAGhB,MAAM,0BAA0B,CAAC;AAMlC,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAU7E"}
@@ -1,9 +1,15 @@
1
+ import { COOKIE_MESSAGE, PRIVACY_MANAGER } from "./constants.ts";
1
2
  export declare const INITIAL_STATE: Readonly<{
2
3
  activeComponent: "cookie-message";
4
+ messageId: 0;
5
+ privacyManagerId: 0;
3
6
  }>;
4
7
  export declare function isPlainObject(obj: unknown): obj is object;
5
8
  export declare const getState: () => {
6
9
  [x: string]: string | number | boolean | null | undefined;
10
+ activeComponent: typeof COOKIE_MESSAGE | typeof PRIVACY_MANAGER;
11
+ messageId: number;
12
+ privacyManagerId: number;
7
13
  };
8
14
  export declare const setState: (newState: unknown) => void;
9
15
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/tracking/state.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;EAExB,CAAC;AAIH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAOzD;AAGD,eAAO,MAAM,QAAQ;;CAA8B,CAAC;AAEpD,eAAO,MAAM,QAAQ,aAAc,OAAO,SAOzC,CAAC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/tracking/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AASjE,eAAO,MAAM,aAAa;;;;EAIxB,CAAC;AAIH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAOzD;AAGD,eAAO,MAAM,QAAQ;;qBAvBF,qBAAqB,GAAG,sBAAsB;eACpD,MAAM;sBACC,MAAM;CAqByB,CAAC;AAEpD,eAAO,MAAM,QAAQ,aAAc,OAAO,SAOzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=url.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/__tests__/url.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Function to check if a provided hostname contains a particular root domain
3
+ * This will help us determine the correct property config for the current window.location
4
+ * @param hostname Current hostname
5
+ * @param rootDomain Root domain to validate against
6
+ */
7
+ export declare function containsRootDomain(hostname: string, rootDomain: string): boolean;
8
+ /**
9
+ * Function to get property config based on the hostname of window.location
10
+ * @param hostname - window.location.href hostname
11
+ */
12
+ export declare function getPropertyConfigByHostname(hostname: string): {
13
+ accountId: number;
14
+ baseEndpoint: string;
15
+ propertyHref: string;
16
+ _clientOptions: {
17
+ privacyManagerId: number;
18
+ manageCookiesLinkOverride: string;
19
+ };
20
+ joinHref: boolean;
21
+ gdpr: {};
22
+ ccpa: {};
23
+ } | {
24
+ accountId: number;
25
+ baseEndpoint: string;
26
+ propertyId: number;
27
+ _clientOptions: {
28
+ privacyManagerId: number;
29
+ manageCookiesLinkOverride: string;
30
+ rootDomain: string;
31
+ };
32
+ joinHref: boolean;
33
+ gdpr: {};
34
+ ccpa: {};
35
+ } | {
36
+ accountId: number;
37
+ baseEndpoint: string;
38
+ propertyId: number;
39
+ _clientOptions: {
40
+ rootDomain: string;
41
+ };
42
+ joinHref: boolean;
43
+ gdpr: {};
44
+ ccpa: {};
45
+ } | {
46
+ accountId: number;
47
+ baseEndpoint: string;
48
+ propertyId: number;
49
+ _clientOptions: {
50
+ rootDomain: string;
51
+ };
52
+ joinHref: boolean;
53
+ gdpr: {};
54
+ ccpa: {};
55
+ } | {
56
+ accountId: number;
57
+ baseEndpoint: string;
58
+ propertyId: number;
59
+ _clientOptions: {
60
+ rootDomain: string;
61
+ };
62
+ joinHref: boolean;
63
+ gdpr: {};
64
+ ccpa: {};
65
+ } | {
66
+ accountId: number;
67
+ baseEndpoint: string;
68
+ propertyId: number;
69
+ _clientOptions: {
70
+ rootDomain: string;
71
+ };
72
+ joinHref: boolean;
73
+ gdpr: {};
74
+ ccpa: {};
75
+ } | {
76
+ accountId: number;
77
+ baseEndpoint: string;
78
+ propertyId: number;
79
+ _clientOptions: {
80
+ rootDomain: string;
81
+ };
82
+ joinHref: boolean;
83
+ gdpr: {};
84
+ ccpa: {};
85
+ } | {
86
+ accountId: number;
87
+ baseEndpoint: string;
88
+ propertyId: number;
89
+ _clientOptions: {
90
+ rootDomain: string;
91
+ };
92
+ joinHref: boolean;
93
+ gdpr: {};
94
+ ccpa: {};
95
+ } | {
96
+ accountId: number;
97
+ baseEndpoint: string;
98
+ propertyId: number;
99
+ _clientOptions: {
100
+ rootDomain: string;
101
+ };
102
+ joinHref: boolean;
103
+ gdpr: {};
104
+ ccpa: {};
105
+ } | {
106
+ accountId: number;
107
+ baseEndpoint: string;
108
+ propertyId: number;
109
+ _clientOptions: {
110
+ rootDomain: string;
111
+ };
112
+ joinHref: boolean;
113
+ gdpr: {};
114
+ ccpa: {};
115
+ } | {
116
+ accountId: number;
117
+ baseEndpoint: string;
118
+ propertyId: number;
119
+ _clientOptions: {
120
+ rootDomain: string;
121
+ };
122
+ joinHref: boolean;
123
+ gdpr: {};
124
+ ccpa: {};
125
+ };
126
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAWtE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa3D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/cmp-client",
3
- "version": "3.2.0",
3
+ "version": "3.3.0-beta.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -16,17 +16,16 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@iabtechlabtcf/core": "^1.5.10",
20
- "next-session-client": "^5.0.0",
21
- "uuid": "^9.0.1"
19
+ "next-session-client": "^5.0.1"
22
20
  },
23
21
  "devDependencies": {
24
- "@types/uuid": "^9.0.7",
25
- "eslint": "^8.53.0",
22
+ "@types/uuid": "^9.0.8",
23
+ "eslint": "^8.56.0",
26
24
  "npm-run-all": "^4.1.5",
27
- "typescript": "^5.2.2",
28
- "vite": "^4.5.0",
29
- "vitest": "^0.34.6"
25
+ "rimraf": "^5.0.5",
26
+ "typescript": "^5.3.3",
27
+ "vite": "^5.1.1",
28
+ "vitest": "^1.2.2"
30
29
  },
31
30
  "scripts": {
32
31
  "lint": "eslint ./src ./typings --ext .ts",
@@ -34,9 +33,10 @@
34
33
  "checks:unit": "npm t -- --run",
35
34
  "checks:types": "tsc",
36
35
  "checks": "run-s checks:*",
37
- "build:lib": "vite build",
36
+ "build:lib": "vite build --config vite.config.lib.ts",
37
+ "build:static": "vite build --config vite.config.static.ts",
38
38
  "build:types": "tsc",
39
- "build": "run-s build:*",
39
+ "build": "rimraf ./dist && run-s build:*",
40
40
  "test": "vitest"
41
41
  }
42
42
  }
@@ -1,3 +1,5 @@
1
+ import { TCData } from "./types";
2
+
1
3
  export {};
2
4
 
3
5
  declare global {
@@ -6,7 +8,9 @@ declare global {
6
8
  _sp_: {
7
9
  config: SPConfig;
8
10
  addEventListener?: (e: string, callback: SPEventCallback) => void;
11
+ gdpr?: { loadPrivacyManagerModal: (id: number | undefined) => void };
9
12
  };
10
13
  _sp_queue: (() => void)[];
14
+ __tcfapi: (key: string, n: number, callback: (resp: TCData) => void) => void;
11
15
  }
12
16
  }