@phantomstudios/ft-lib 0.4.1-rc1 → 0.5.0-rc10

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 (67) hide show
  1. package/.github/CODEOWNERS +1 -1
  2. package/.github/dependabot.yml +11 -0
  3. package/.github/workflows/pr.yml +4 -1
  4. package/.github/workflows/release.yml +9 -2
  5. package/.nvmrc +1 -1
  6. package/CODE_OF_CONDUCT.md +1 -1
  7. package/CONTRIBUTING.md +3 -5
  8. package/SUPPORT.md +3 -3
  9. package/eslint.config.mjs +91 -0
  10. package/jest.config.js +1 -6
  11. package/lib/FTTracking/index.d.ts +3 -0
  12. package/lib/FTTracking/index.d.ts.map +1 -1
  13. package/lib/FTTracking/index.js +14 -1
  14. package/lib/FTTracking/index.js.map +1 -1
  15. package/lib/cmp/loadFtCmp.d.ts +3 -0
  16. package/lib/cmp/loadFtCmp.d.ts.map +1 -0
  17. package/lib/cmp/loadFtCmp.js +31 -0
  18. package/lib/cmp/loadFtCmp.js.map +1 -0
  19. package/lib/consentMonitor/index.d.ts +12 -12
  20. package/lib/consentMonitor/index.d.ts.map +1 -1
  21. package/lib/consentMonitor/index.js +111 -68
  22. package/lib/consentMonitor/index.js.map +1 -1
  23. package/lib/gaTracker/index.js +1 -2
  24. package/lib/gaTracker/index.js.map +1 -1
  25. package/lib/index.d.ts +7 -3
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/index.js +7 -4
  28. package/lib/index.js.map +1 -1
  29. package/lib/oTracker/index.js.map +1 -1
  30. package/lib/permutiveVideoUtils/index.d.ts.map +1 -1
  31. package/lib/permutiveVideoUtils/index.js +1 -1
  32. package/lib/permutiveVideoUtils/index.js.map +1 -1
  33. package/lib/reactPlayerTracking/index.d.ts.map +1 -1
  34. package/lib/reactPlayerTracking/index.js +1 -1
  35. package/lib/reactPlayerTracking/index.js.map +1 -1
  36. package/lib/utils/attention.js.map +1 -1
  37. package/lib/utils/cookies.js +1 -2
  38. package/lib/utils/cookies.js.map +1 -1
  39. package/lib/utils/getTrace.js.map +1 -1
  40. package/lib/utils/intersectionObserverPolyfill.d.ts +1 -0
  41. package/lib/utils/intersectionObserverPolyfill.js +1 -0
  42. package/lib/utils/intersectionObserverPolyfill.js.map +1 -1
  43. package/lib/utils/scroll.js.map +1 -1
  44. package/lib/utils/yupValidator.d.ts.map +1 -1
  45. package/lib/utils/yupValidator.js +2 -2
  46. package/lib/utils/yupValidator.js.map +1 -1
  47. package/lib/ytIframeTracking/index.d.ts +0 -1
  48. package/lib/ytIframeTracking/index.d.ts.map +1 -1
  49. package/lib/ytIframeTracking/index.js.map +1 -1
  50. package/package.json +27 -17
  51. package/src/FTTracking/index.ts +21 -4
  52. package/src/cmp/loadFtCmp.ts +28 -0
  53. package/src/consentMonitor/index.ts +108 -85
  54. package/src/gaTracker/index.ts +4 -4
  55. package/src/index.ts +10 -3
  56. package/src/oTracker/index.ts +5 -5
  57. package/src/permutiveVideoUtils/index.ts +2 -2
  58. package/src/reactPlayerTracking/index.ts +4 -4
  59. package/src/types.d.ts +24 -5
  60. package/src/utils/attention.js +9 -9
  61. package/src/utils/getTrace.js +2 -2
  62. package/src/utils/scroll.ts +2 -2
  63. package/src/utils/yupValidator.ts +6 -6
  64. package/src/ytIframeTracking/index.ts +9 -9
  65. package/test/index.test.tsx +13 -12
  66. package/tsconfig.json +3 -1
  67. package/.eslintrc +0 -58
@@ -1 +1 @@
1
- * @digitaljohn
1
+ * @JPedersen @DhiaPhntm
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "npm" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "monthly"
@@ -9,9 +9,12 @@ jobs:
9
9
  test:
10
10
  runs-on: ubuntu-latest
11
11
 
12
+ permissions:
13
+ contents: read
14
+
12
15
  strategy:
13
16
  matrix:
14
- node-version: [16.x, 18.x, 20.x]
17
+ node-version: [18.x, 20.x, 22.x]
15
18
 
16
19
  steps:
17
20
  - uses: actions/checkout@v1
@@ -8,9 +8,12 @@ jobs:
8
8
  test:
9
9
  runs-on: ubuntu-latest
10
10
 
11
+ permissions:
12
+ contents: read
13
+
11
14
  strategy:
12
15
  matrix:
13
- node-version: [16.x, 18.x, 20.x]
16
+ node-version: [18.x, 20.x, 22.x]
14
17
 
15
18
  steps:
16
19
  - uses: actions/checkout@v1
@@ -32,11 +35,15 @@ jobs:
32
35
  publish-npm:
33
36
  needs: test
34
37
  runs-on: ubuntu-latest
38
+
39
+ permissions:
40
+ contents: read
41
+
35
42
  steps:
36
43
  - uses: actions/checkout@v2
37
44
  - uses: actions/setup-node@v1
38
45
  with:
39
- node-version: 20
46
+ node-version: 22
40
47
  registry-url: https://registry.npmjs.org/
41
48
  - run: npm ci
42
49
  - run: npm publish --access=public
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v20.12.1
1
+ v18.18.0
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at developers@phntms.com. All
58
+ reported by contacting the project team at developers@phantom.agency. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
package/CONTRIBUTING.md CHANGED
@@ -4,7 +4,7 @@ I'm really happy that you're interested in helping out with this little project.
4
4
 
5
5
  As this is very early days for the project there's not a lot in the way of
6
6
  resources, but please check out the [documentation](./README.md), and also the
7
- [list of issues](https://github.com/phantomstudios/@phntms/ft-lib/issues).
7
+ [list of issues](https://github.com/phantomstudios/ft-lib/issues).
8
8
 
9
9
  Please submit an issue if you need help with anything.
10
10
 
@@ -20,7 +20,7 @@ pass. Testing is automated using GitHub Actions CI.
20
20
  ## Submitting changes
21
21
 
22
22
  Please send a
23
- [GitHub Pull Request to @phntms/ft-lib](https://github.com/phantomstudios/@phntms/ft-lib/pull/new/master)
23
+ [GitHub Pull Request to @phantomstudios/ft-lib](https://github.com/phantomstudios/ft-lib/pull/new/master)
24
24
  with a clear list of what you've done (read more about
25
25
  [pull requests](https://help.github.com/en/articles/about-pull-requests)). When you send a pull
26
26
  request, please make sure you've covered off all the points in the template.
@@ -43,6 +43,4 @@ In effect this means:
43
43
  - Your Pull Request title and description become very important; they are the
44
44
  history of the master branch and explain all the changes.
45
45
  - You ought to be able to find any previous version easily using GitHub tabs, or
46
- [Releases](https://github.com/phantomstudios/@phntms/ft-lib/releases)
47
-
48
- Thanks, John Chipps-Harding
46
+ [Releases](https://github.com/phantomstudios/ft-lib/releases)
package/SUPPORT.md CHANGED
@@ -1,4 +1,4 @@
1
- # @phntms/ft-lib Support
1
+ # @phantomstudios/ft-lib Support
2
2
 
3
- For _questions_ on how to use `@phntms/ft-lib` or what went wrong when you tried something, our primary resource is by opening a
4
- [GitHub Issue](https://github.com/phantomstudios/@phntms/ft-lib/issues), where you can get help from developers.
3
+ For _questions_ on how to use `@phantomstudios/ft-lib` or what went wrong when you tried something, our primary resource is by opening a
4
+ [GitHub Issue](https://github.com/phantomstudios/ft-lib/issues), where you can get help from developers.
@@ -0,0 +1,91 @@
1
+ import { defineConfig } from "eslint/config";
2
+ import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
3
+ import prettier from "eslint-plugin-prettier";
4
+ import _import from "eslint-plugin-import";
5
+ import globals from "globals";
6
+ import tsParser from "@typescript-eslint/parser";
7
+ import path from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ import js from "@eslint/js";
10
+ import { FlatCompat } from "@eslint/eslintrc";
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+ const compat = new FlatCompat({
15
+ baseDirectory: __dirname,
16
+ recommendedConfig: js.configs.recommended,
17
+ allConfig: js.configs.all
18
+ });
19
+
20
+ export default defineConfig([{
21
+ ignores: [
22
+ "src/utils/intersectionObserverPolyfill.js",
23
+ ],
24
+
25
+ extends: fixupConfigRules(compat.extends(
26
+ "plugin:react/recommended",
27
+ "plugin:react-hooks/recommended",
28
+ "plugin:@typescript-eslint/recommended",
29
+ "plugin:prettier/recommended",
30
+ )),
31
+
32
+ plugins: {
33
+ prettier: fixupPluginRules(prettier),
34
+ import: fixupPluginRules(_import),
35
+ },
36
+
37
+ languageOptions: {
38
+ globals: {
39
+ ...globals.browser,
40
+ ...globals.node,
41
+ ...globals.jest,
42
+ React: "writable",
43
+ },
44
+
45
+ parser: tsParser,
46
+ ecmaVersion: 5,
47
+ sourceType: "commonjs",
48
+
49
+ parserOptions: {
50
+ jsx: true,
51
+ useJSXTextNode: true,
52
+ },
53
+ },
54
+
55
+ settings: {
56
+ react: {
57
+ version: "detect",
58
+ },
59
+ },
60
+
61
+ rules: {
62
+ "react-hooks/rules-of-hooks": "error",
63
+ "react-hooks/exhaustive-deps": "error",
64
+ "react/react-in-jsx-scope": "off",
65
+ "@typescript-eslint/explicit-function-return-type": "off",
66
+ "@typescript-eslint/explicit-module-boundary-types": "off",
67
+ "@typescript-eslint/ban-ts-comment": "off",
68
+ "@typescript-eslint/no-explicit-any": "off",
69
+ "react/prop-types": "off",
70
+
71
+ "import/order": ["error", {
72
+ groups: ["builtin", "external", "internal"],
73
+
74
+ pathGroups: [{
75
+ pattern: "react",
76
+ group: "external",
77
+ position: "before",
78
+ }],
79
+
80
+ pathGroupsExcludedImportTypes: ["react"],
81
+ "newlines-between": "always",
82
+
83
+ alphabetize: {
84
+ order: "asc",
85
+ caseInsensitive: true,
86
+ },
87
+ }],
88
+
89
+ "prettier/prettier": "error",
90
+ },
91
+ }]);
package/jest.config.js CHANGED
@@ -6,7 +6,7 @@ module.exports = {
6
6
  '<rootDir>/test'
7
7
  ],
8
8
  transform: {
9
- '^.+\\.tsx?$': 'ts-jest'
9
+ '^.+\\.tsx?$': ['ts-jest', {tsconfig: 'tsconfig.test.json'}]
10
10
  },
11
11
  moduleFileExtensions: [
12
12
  'ts',
@@ -16,9 +16,4 @@ module.exports = {
16
16
  'json',
17
17
  'node'
18
18
  ],
19
- globals: {
20
- 'ts-jest': {
21
- tsConfig: 'tsconfig.test.json'
22
- }
23
- }
24
19
  }
@@ -1,3 +1,4 @@
1
+ import { ConsentMonitor } from "../consentMonitor";
1
2
  import { gaTracker } from "../gaTracker";
2
3
  import { oTracker } from "../oTracker";
3
4
  import { ScrollTracker } from "../utils/scroll";
@@ -18,12 +19,14 @@ export declare class FTTracking {
18
19
  scrollTracker: ScrollTracker;
19
20
  disableAppFormatTransform: boolean;
20
21
  logValidationErrors: boolean;
22
+ consentMonitor: ConsentMonitor | undefined;
21
23
  oEvent: (detail: OrigamiEventType) => void;
22
24
  gaEvent: (category: string, action: string, label: string) => void;
23
25
  gtmEvent: (category: string, action: string, label: string) => void;
24
26
  constructor(config: ConfigType, options?: TrackingOptions);
25
27
  set config(c: ConfigType);
26
28
  get config(): ConfigType;
29
+ initializeConsentMonitor: () => ConsentMonitor;
27
30
  newPageView(config: ConfigType): void;
28
31
  }
29
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FTTracking/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAEL,UAAU,EACV,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,eAAe;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,i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AC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AASD,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;IAC7B,yBAAyB,EAAE,OAAO,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,cAAc,GAAG,SAAS,CAAC;IAC3C,MAAM,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;gBAExD,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,eAAe;IA2BzD,IAAI,MAAM,CAAC,CAAC,EAAE,UAAU,EAGvB;IACD,IAAI,MAAM,IAJI,UAAU,CAMvB;IAED,wBAAwB,uBAQtB;IAEK,WAAW,CAAC,MAAM,EAAE,UAAU;CAkBtC"}
@@ -25,6 +25,16 @@ var DEFAULT_OPTIONS = {
25
25
  };
26
26
  var FTTracking = /** @class */ (function () {
27
27
  function FTTracking(config, options) {
28
+ var _this = this;
29
+ this.initializeConsentMonitor = function () {
30
+ if (!_this.consentMonitor) {
31
+ _this.consentMonitor = new consentMonitor_1.ConsentMonitor(window.location.hostname, [
32
+ ".app",
33
+ "preview",
34
+ ]);
35
+ }
36
+ return _this.consentMonitor;
37
+ };
28
38
  this.options = __assign(__assign({}, DEFAULT_OPTIONS), options);
29
39
  this.oTracker = new oTracker_1.oTracker(config, this.options);
30
40
  this.gaTracker = new gaTracker_1.gaTracker(this.options);
@@ -41,7 +51,10 @@ var FTTracking = /** @class */ (function () {
41
51
  this.scrollTracker = new scroll_1.ScrollTracker(this);
42
52
  //cookie consent monitor for permutive tracking
43
53
  window.addEventListener("load", function () {
44
- new consentMonitor_1.consentMonitor(window.location.hostname, [".app", "preview"]);
54
+ _this.consentMonitor = new consentMonitor_1.ConsentMonitor(window.location.hostname, [
55
+ ".app",
56
+ "preview",
57
+ ]);
45
58
  });
46
59
  }
47
60
  Object.defineProperty(FTTracking.prototype, "config", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/FTTracking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAAmD;AACnD,0CAAyC;AACzC,wCAAuC;AACvC,0CAAgD;AAChD,sDAI+B;AAW/B,IAAM,eAAe,GAAG;IACtB,qBAAqB,EAAE,mBAAmB;IAC1C,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF;IAYE,oBAAY,MAAkB,EAAE,OAAyB;QACvD,IAAI,CAAC,OAAO,yBAAQ,eAAe,GAAK,OAAO,CAAE,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,yBAAyB;YAC5B,IAAI,CAAC,OAAO,CAAC,yBAAyB,IAAI,KAAK,CAAC;QAClD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,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AO,CAAC,kBAAkB,EAAE,CAAC;YACpC,IAAI,CAAC,QAAQ,CAAC,uBAAuB,EAAE,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,CAAC;QACD,mDAAmD;IACrD,CAAC;IACH,iBAAC;AAAD,CAAC,AA5ED,IA4EC;AA5EY,gCAAU"}
@@ -0,0 +1,3 @@
1
+ export declare function loadFtCmpScript(): Promise<void>;
2
+ export declare function enqueueCmpCallback(cb: () => void): void;
3
+ //# sourceMappingURL=loadFtCmp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadFtCmp.d.ts","sourceRoot":"","sources":["../../src/cmp/loadFtCmp.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAoB/C;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAKvD"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadFtCmpScript = loadFtCmpScript;
4
+ exports.enqueueCmpCallback = enqueueCmpCallback;
5
+ function loadFtCmpScript() {
6
+ if (document.getElementById("ft-cmp-loader")) {
7
+ return Promise.resolve();
8
+ }
9
+ return new Promise(function (resolve, reject) {
10
+ var script = document.createElement("script");
11
+ script.id = "ft-cmp-loader";
12
+ script.async = true;
13
+ script.src = "https://consent-notice.ft.com/cmp.js";
14
+ script.referrerPolicy = window.location.hostname.endsWith(".ft.com")
15
+ ? "" // production hosts
16
+ : "no-referrer-when-downgrade"; // localhost / preview
17
+ script.onload = function () { return resolve(); };
18
+ script.onerror = function () {
19
+ return reject(new Error("Sourcepoint CMP script failed to load"));
20
+ };
21
+ document.head.appendChild(script);
22
+ });
23
+ }
24
+ function enqueueCmpCallback(cb) {
25
+ if (!window._sp_)
26
+ window._sp_ = {};
27
+ if (!window._sp_queue)
28
+ window._sp_queue = [];
29
+ window._sp_queue.push(cb);
30
+ }
31
+ //# sourceMappingURL=loadFtCmp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadFtCmp.js","sourceRoot":"","sources":["../../src/cmp/loadFtCmp.ts"],"names":[],"mappings":";;AAAA,0CAoBC;AAED,gDAKC;AA3BD,SAAgB,eAAe;IAC7B,IAAI,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,OAAO,CAAO,UAAC,OAAO,EAAE,MAAM;QACvC,IAAM,MAAM,GAAsB,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACnE,MAAM,CAAC,EAAE,GAAG,eAAe,CAAC;QAC5B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,CAAC,GAAG,GAAG,sCAAsC,CAAC;QACpD,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;YAClE,CAAC,CAAC,EAAE,CAAC,mBAAmB;YACxB,CAAC,CAAC,4BAA4B,CAAC,CAAC,sBAAsB;QAExD,MAAM,CAAC,MAAM,GAAG,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS,CAAC;QAChC,MAAM,CAAC,OAAO,GAAG;YACf,OAAA,MAAM,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAA1D,CAA0D,CAAC;QAE7D,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,kBAAkB,CAAC,EAAc;IAC/C,IAAI,CAAC,MAAM,CAAC,IAAI;QAAE,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;IACnC,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;IAE7C,MAAM,CAAC,SAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC"}
@@ -1,19 +1,19 @@
1
- export declare class consentMonitor {
2
- protected _consent: boolean;
3
- protected _devHosts: string[];
4
- protected _isDevEnvironment: boolean;
5
- protected _hostname: string;
6
- protected _isInitialized: boolean;
7
- constructor(hostname?: string, devHosts?: string[] | string);
1
+ export declare class ConsentMonitor {
2
+ private _consent;
3
+ private _devHosts;
4
+ private _isDevEnvironment;
5
+ private _isInitialized;
8
6
  get consent(): boolean;
9
- get devHosts(): string[] | string;
7
+ get devHosts(): string[];
10
8
  get isDevEnvironment(): boolean;
11
9
  get isInitialized(): boolean;
10
+ get userHasConsented(): boolean;
12
11
  getCookieValue: (name: string) => string;
13
- init: () => void;
12
+ constructor(hostname?: string, devHosts?: string[] | string);
13
+ private attachCmpListeners;
14
+ private enablePermutive;
15
+ private disablePermutive;
14
16
  cookieConsentTest: () => void;
15
- setDevCookieHandler: () => void;
16
- permutiveConsentOn: () => void;
17
- permutiveConsentOff: () => void;
18
17
  }
18
+ export { ConsentMonitor as consentMonitor };
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consentMonitor/index.ts"],"names":[],"mappings":"AAKA,qBAAa,cAAc;IACzB,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC9B,SAAS,CAAC,iBAAiB,UAAS;IACpC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,cAAc,UAAS;gBAErB,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM;IAc3D,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,QAAQ,IAAI,MAAM,EAAE,GAAG,MAAM,CAEhC;IAED,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,cAAc,SAAU,MAAM,YACgD;IAE9E,IAAI,aASF;IAEF,iBAAiB,aA6Bf;IAEF,mBAAmB,aAkBjB;IAEF,kBAAkB,aAMhB;IAEF,mBAAmB,aAGjB;CACH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consentMonitor/index.ts"],"names":[],"mappings":"AA2BA,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAW;IAC5B,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,cAAc,CAAS;IAE/B,IAAW,OAAO,IAAI,OAAO,CAE5B;IACD,IAAW,QAAQ,IAAI,MAAM,EAAE,CAE9B;IACD,IAAW,gBAAgB,IAAI,OAAO,CAErC;IACD,IAAW,aAAa,IAAI,OAAO,CAElC;IAED,IAAW,gBAAgB,IAAI,OAAO,CAErC;IAED,cAAc,GAAI,MAAM,MAAM,YACgD;gBAElE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM;IA6B3D,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,gBAAgB;IAQxB,iBAAiB,aAcf;CACH;AAED,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,CAAC"}
@@ -1,117 +1,160 @@
1
1
  "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
5
14
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.consentMonitor = void 0;
15
+ exports.consentMonitor = exports.ConsentMonitor = void 0;
16
+ var cmp_client_1 = require("@financial-times/cmp-client");
7
17
  var debug_1 = __importDefault(require("debug"));
8
- var debug = (0, debug_1.default)("@phntms/ft-lib");
18
+ var loadFtCmp_1 = require("../cmp/loadFtCmp");
19
+ var debug = (0, debug_1.default)("@phantomstudios/ft-lib/consentMonitor");
9
20
  var DEFAULT_DEV_HOSTS = ["localhost", "phq", ".app", "preview"];
10
- var consentMonitor = /** @class */ (function () {
11
- function consentMonitor(hostname, devHosts) {
21
+ var CMP_CHOICE_ACCEPT_ALL = 11;
22
+ var CMP_CHOICE_REJECT_ALL = 13;
23
+ var ConsentMonitor = /** @class */ (function () {
24
+ function ConsentMonitor(hostname, devHosts) {
12
25
  var _this = this;
13
26
  this._consent = false;
14
27
  this._isDevEnvironment = false;
15
28
  this._isInitialized = false;
16
29
  this.getCookieValue = function (name) { var _a; return ((_a = document.cookie.match("(^|;)\\s*" + name + "\\s*=\\s*([^;]+)")) === null || _a === void 0 ? void 0 : _a.pop()) || ""; };
17
- this.init = function () {
18
- _this.cookieConsentTest();
19
- setInterval(_this.cookieConsentTest, 3000);
20
- //Simulate cookie consent behaviour in non-prod environments
21
- _this._devHosts.map(function (devHost) {
22
- return _this._hostname.includes(devHost) && _this.setDevCookieHandler();
23
- });
24
- };
30
+ //check for FTConsent - cookiesOnSite to trigger custom consent_update event for GTM tags (banner updated)
25
31
  this.cookieConsentTest = function () {
26
- if (window.permutive) {
27
- if (!_this._isInitialized) {
28
- if (_this.getCookieValue("FTConsent").includes("behaviouraladsOnsite%3Aon")) {
29
- _this.permutiveConsentOn();
30
- }
31
- else {
32
- _this.permutiveConsentOff();
33
- }
34
- _this._isInitialized = true;
35
- }
36
- else if (_this.getCookieValue("FTConsent").includes("behaviouraladsOnsite%3Aon") &&
37
- !_this.consent) {
38
- debug("setting permutive tracking consent: on");
39
- _this.permutiveConsentOn();
40
- }
41
- else if (!_this.getCookieValue("FTConsent").includes("behaviouraladsOnsite%3Aon") &&
42
- _this.consent) {
43
- debug("setting permutive tracking consent: off");
44
- _this.permutiveConsentOff();
45
- }
32
+ if (!_this._isInitialized || !window || !window.dataLayer)
33
+ return;
34
+ if (_this.getCookieValue("FTConsent").includes("cookiesOnsite%3Aon")) {
35
+ //send consent_update event
36
+ window.dataLayer.push({
37
+ event: "consent_update",
38
+ consent: true,
39
+ });
46
40
  }
47
- };
48
- this.setDevCookieHandler = function () {
49
- _this._isDevEnvironment = true;
50
- debug("setting development environment from host match");
51
- var oCookieMessage = document.getElementsByClassName("o-cookie-message")[0];
52
- if (oCookieMessage) {
53
- var onCookieMessageAct_1 = function () {
54
- debug("setting development FT consent cookies");
55
- document.cookie = "FTConsent=behaviouraladsOnsite%3Aon";
56
- document.cookie = "FTCookieConsentGDPR=true";
57
- oCookieMessage.removeEventListener("oCookieMessage.act", onCookieMessageAct_1, false);
58
- };
59
- oCookieMessage.addEventListener("oCookieMessage.act", onCookieMessageAct_1);
41
+ else {
42
+ window.dataLayer.push({
43
+ event: "consent_update",
44
+ consent: false,
45
+ });
60
46
  }
61
47
  };
62
- this.permutiveConsentOn = function () {
63
- window.permutive.consent({
64
- opt_in: true,
65
- token: "behaviouraladsOnsite:on",
66
- });
67
- _this._consent = true;
68
- };
69
- this.permutiveConsentOff = function () {
70
- window.permutive.consent({ opt_in: false });
71
- _this._consent = false;
72
- };
73
48
  if (Array.isArray(devHosts)) {
74
- this._devHosts = devHosts.concat(DEFAULT_DEV_HOSTS);
49
+ this._devHosts = __spreadArray(__spreadArray([], devHosts, true), DEFAULT_DEV_HOSTS, true);
75
50
  }
76
51
  else if (devHosts === undefined) {
77
- this._devHosts = DEFAULT_DEV_HOSTS;
52
+ this._devHosts = __spreadArray([], DEFAULT_DEV_HOSTS, true);
78
53
  }
79
54
  else {
80
- this._devHosts = DEFAULT_DEV_HOSTS;
81
- this._devHosts.push(devHosts);
55
+ this._devHosts = __spreadArray(__spreadArray([], DEFAULT_DEV_HOSTS, true), [devHosts], false);
82
56
  }
83
- this._hostname = hostname || window.location.hostname;
84
- this.init();
57
+ var hostToCheck = hostname !== null && hostname !== void 0 ? hostname : window.location.hostname;
58
+ this._isDevEnvironment = this._devHosts.some(function (h) {
59
+ return hostToCheck.includes(h);
60
+ });
61
+ (0, loadFtCmp_1.loadFtCmpScript)()
62
+ .then(function () {
63
+ _this.attachCmpListeners();
64
+ // const propertyConfig = window.location.hostname.endsWith("ft.com")
65
+ // ? properties["FT_DOTCOM_PROD"]
66
+ // : properties["FT_DOTCOM_TEST"];
67
+ // initialize CMP - duplicate?
68
+ //initSourcepointCmp({ propertyConfig });
69
+ // use cmp client lib to intercept footer 'Manage Cookies' links (opens privacy modal)
70
+ // Note, function requires very specific link: text = 'Manage Cookies' and href = 'https://ft.com/preferences/manage-cookies'
71
+ })
72
+ .catch(function (err) { return console.error(err); });
85
73
  }
86
- Object.defineProperty(consentMonitor.prototype, "consent", {
74
+ Object.defineProperty(ConsentMonitor.prototype, "consent", {
87
75
  get: function () {
88
76
  return this._consent;
89
77
  },
90
78
  enumerable: false,
91
79
  configurable: true
92
80
  });
93
- Object.defineProperty(consentMonitor.prototype, "devHosts", {
81
+ Object.defineProperty(ConsentMonitor.prototype, "devHosts", {
94
82
  get: function () {
95
83
  return this._devHosts;
96
84
  },
97
85
  enumerable: false,
98
86
  configurable: true
99
87
  });
100
- Object.defineProperty(consentMonitor.prototype, "isDevEnvironment", {
88
+ Object.defineProperty(ConsentMonitor.prototype, "isDevEnvironment", {
101
89
  get: function () {
102
90
  return this._isDevEnvironment;
103
91
  },
104
92
  enumerable: false,
105
93
  configurable: true
106
94
  });
107
- Object.defineProperty(consentMonitor.prototype, "isInitialized", {
95
+ Object.defineProperty(ConsentMonitor.prototype, "isInitialized", {
108
96
  get: function () {
109
97
  return this._isInitialized;
110
98
  },
111
99
  enumerable: false,
112
100
  configurable: true
113
101
  });
114
- return consentMonitor;
102
+ Object.defineProperty(ConsentMonitor.prototype, "userHasConsented", {
103
+ get: function () {
104
+ return this._consent;
105
+ },
106
+ enumerable: false,
107
+ configurable: true
108
+ });
109
+ ConsentMonitor.prototype.attachCmpListeners = function () {
110
+ var _this = this;
111
+ (0, loadFtCmp_1.enqueueCmpCallback)(function () {
112
+ var _a, _b, _d, _e;
113
+ var onReady = function (_l, _u, _t, info) {
114
+ debug("onConsentReady:", info);
115
+ if (info.consentedToAll) {
116
+ _this.enablePermutive();
117
+ }
118
+ else {
119
+ _this.disablePermutive();
120
+ }
121
+ };
122
+ var onChoice = function (_l, _c, typeId) {
123
+ debug("onMessageChoiceSelect:", typeId);
124
+ if (typeId === CMP_CHOICE_ACCEPT_ALL)
125
+ _this.enablePermutive();
126
+ else if (typeId === CMP_CHOICE_REJECT_ALL)
127
+ _this.disablePermutive();
128
+ // banner updated - check new cookie value to fire consent_update event
129
+ setTimeout(_this.cookieConsentTest, 3000);
130
+ };
131
+ (_b = (_a = window._sp_).addEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "onConsentReady", onReady);
132
+ (_e = (_d = window._sp_).addEventListener) === null || _e === void 0 ? void 0 : _e.call(_d, "onMessageChoiceSelect", onChoice);
133
+ _this._isInitialized = true;
134
+ (0, cmp_client_1.interceptManageCookiesLinks)();
135
+ });
136
+ };
137
+ ConsentMonitor.prototype.enablePermutive = function () {
138
+ var _a;
139
+ if (this._consent)
140
+ return;
141
+ debug("Permutive consent: ON");
142
+ (_a = window.permutive) === null || _a === void 0 ? void 0 : _a.consent({
143
+ opt_in: true,
144
+ token: "behaviouraladsOnsite:on",
145
+ });
146
+ this._consent = true;
147
+ };
148
+ ConsentMonitor.prototype.disablePermutive = function () {
149
+ var _a;
150
+ if (!this._consent)
151
+ return;
152
+ debug("Permutive consent: OFF");
153
+ (_a = window.permutive) === null || _a === void 0 ? void 0 : _a.consent({ opt_in: false });
154
+ this._consent = false;
155
+ };
156
+ return ConsentMonitor;
115
157
  }());
116
- exports.consentMonitor = consentMonitor;
158
+ exports.ConsentMonitor = ConsentMonitor;
159
+ exports.consentMonitor = ConsentMonitor;
117
160
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consentMonitor/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAC1B,IAAM,KAAK,GAAG,IAAA,eAAK,EAAC,gBAAgB,CAAC,CAAC;AAEtC,IAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAElE;IAOE,wBAAY,QAAiB,EAAE,QAA4B;QAA3D,iBAYC;QAlBS,aAAQ,GAAG,KAAK,CAAC;QAEjB,sBAAiB,GAAG,KAAK,CAAC;QAE1B,mBAAc,GAAG,KAAK,CAAC;QAgCjC,mBAAc,GAAG,UAAC,IAAY,YAC5B,OAAA,CAAA,MAAA,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,GAAG,kBAAkB,CAAC,0CAAE,GAAG,EAAE,KAAI,EAAE,CAAA,EAAA,CAAC;QAE9E,SAAI,GAAG;YACL,KAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,WAAW,CAAC,KAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAE1C,4DAA4D;YAC5D,KAAI,CAAC,SAAS,CAAC,GAAG,CAChB,UAAC,OAAO;gBACN,OAAA,KAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAI,CAAC,mBAAmB,EAAE;YAA9D,CAA8D,CACjE,CAAC;QACJ,CAAC,CAAC;QAEF,sBAAiB,GAAG;YAClB,IAAI,MAAM,CAAC,SAAS,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