@phantomstudios/ft-lib 0.4.0 → 0.5.0-rc1
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/.github/CODEOWNERS +1 -1
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/pr.yml +4 -1
- package/.github/workflows/release.yml +9 -2
- package/CODE_OF_CONDUCT.md +1 -1
- package/CONTRIBUTING.md +3 -5
- package/SUPPORT.md +3 -3
- package/eslint.config.mjs +91 -0
- package/jest.config.js +1 -6
- package/lib/FTTracking/index.d.ts +2 -0
- package/lib/FTTracking/index.d.ts.map +1 -1
- package/lib/FTTracking/index.js +3 -2
- package/lib/FTTracking/index.js.map +1 -1
- package/lib/cmp/loadFtCmp.d.ts +3 -0
- package/lib/cmp/loadFtCmp.d.ts.map +1 -0
- package/lib/cmp/loadFtCmp.js +31 -0
- package/lib/cmp/loadFtCmp.js.map +1 -0
- package/lib/consentMonitor/index.d.ts +12 -14
- package/lib/consentMonitor/index.d.ts.map +1 -1
- package/lib/consentMonitor/index.js +86 -73
- package/lib/consentMonitor/index.js.map +1 -1
- package/lib/gaTracker/index.js +1 -2
- package/lib/gaTracker/index.js.map +1 -1
- package/lib/index.d.ts +7 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -4
- package/lib/index.js.map +1 -1
- package/lib/oTracker/index.d.ts.map +1 -1
- package/lib/oTracker/index.js +1 -1
- package/lib/oTracker/index.js.map +1 -1
- package/lib/permutiveVideoUtils/index.d.ts.map +1 -1
- package/lib/permutiveVideoUtils/index.js +1 -1
- package/lib/permutiveVideoUtils/index.js.map +1 -1
- package/lib/reactPlayerTracking/index.d.ts.map +1 -1
- package/lib/reactPlayerTracking/index.js +1 -1
- package/lib/reactPlayerTracking/index.js.map +1 -1
- package/lib/utils/attention.js.map +1 -1
- package/lib/utils/cookies.js +1 -2
- package/lib/utils/cookies.js.map +1 -1
- package/lib/utils/getTrace.js.map +1 -1
- package/lib/utils/intersectionObserverPolyfill.d.ts +1 -0
- package/lib/utils/intersectionObserverPolyfill.js +1 -0
- package/lib/utils/intersectionObserverPolyfill.js.map +1 -1
- package/lib/utils/scroll.js.map +1 -1
- package/lib/utils/yupValidator.d.ts +1 -1
- package/lib/utils/yupValidator.d.ts.map +1 -1
- package/lib/utils/yupValidator.js +10 -8
- package/lib/utils/yupValidator.js.map +1 -1
- package/lib/ytIframeTracking/index.d.ts +0 -1
- package/lib/ytIframeTracking/index.d.ts.map +1 -1
- package/lib/ytIframeTracking/index.js.map +1 -1
- package/package.json +25 -17
- package/src/FTTracking/index.ts +9 -2
- package/src/cmp/loadFtCmp.ts +28 -0
- package/src/consentMonitor/index.ts +82 -90
- package/src/gaTracker/index.ts +4 -4
- package/src/index.ts +10 -3
- package/src/oTracker/index.ts +9 -5
- package/src/permutiveVideoUtils/index.ts +2 -2
- package/src/reactPlayerTracking/index.ts +4 -4
- package/src/types.d.ts +13 -5
- package/src/utils/attention.js +9 -9
- package/src/utils/getTrace.js +2 -2
- package/src/utils/scroll.ts +2 -2
- package/src/utils/yupValidator.ts +14 -11
- package/src/ytIframeTracking/index.ts +9 -9
- package/test/index.test.tsx +13 -12
- package/tsconfig.json +3 -1
- package/.eslintrc +0 -58
- package/.nvmrc +0 -1
package/.github/CODEOWNERS
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
* @
|
|
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"
|
package/.github/workflows/pr.yml
CHANGED
|
@@ -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
|
+
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:
|
|
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/CODE_OF_CONDUCT.md
CHANGED
|
@@ -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@
|
|
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
|
|
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 @
|
|
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
|
|
47
|
-
|
|
48
|
-
Thanks, John Chipps-Harding
|
|
46
|
+
[Releases](https://github.com/phantomstudios/ft-lib/releases)
|
package/SUPPORT.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @phantomstudios/ft-lib Support
|
|
2
2
|
|
|
3
|
-
For _questions_ on how to use `@
|
|
4
|
-
[GitHub Issue](https://github.com/phantomstudios
|
|
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
|
}
|
|
@@ -8,6 +8,7 @@ export interface TrackingOptions {
|
|
|
8
8
|
sendGTMPageViewYN?: boolean;
|
|
9
9
|
sendBrandedContent?: boolean;
|
|
10
10
|
disableAppFormatTransform?: boolean;
|
|
11
|
+
logValidationErrors?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare class FTTracking {
|
|
13
14
|
private _config;
|
|
@@ -16,6 +17,7 @@ export declare class FTTracking {
|
|
|
16
17
|
gaTracker: gaTracker;
|
|
17
18
|
scrollTracker: ScrollTracker;
|
|
18
19
|
disableAppFormatTransform: boolean;
|
|
20
|
+
logValidationErrors: boolean;
|
|
19
21
|
oEvent: (detail: OrigamiEventType) => void;
|
|
20
22
|
gaEvent: (category: string, action: string, label: string) => void;
|
|
21
23
|
gtmEvent: (category: string, action: string, label: string) => void;
|
|
@@ -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,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yBAAyB,CAAC,EAAE,OAAO,CAAC;
|
|
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,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,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;IAwBzD,IAAI,MAAM,CAAC,CAAC,EAAE,UAAU,EAGvB;IACD,IAAI,MAAM,IAJI,UAAU,CAMvB;IAEM,WAAW,CAAC,MAAM,EAAE,UAAU;CAkBtC"}
|
package/lib/FTTracking/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var FTTracking = /** @class */ (function () {
|
|
|
30
30
|
this.gaTracker = new gaTracker_1.gaTracker(this.options);
|
|
31
31
|
this.disableAppFormatTransform =
|
|
32
32
|
this.options.disableAppFormatTransform || false;
|
|
33
|
+
this.logValidationErrors = this.options.logValidationErrors || false;
|
|
33
34
|
this.oEvent = this.oTracker.eventDispatcher;
|
|
34
35
|
this.gaEvent = this.options.isCustomGTMEvent
|
|
35
36
|
? this.gaTracker.GTMEventDispatcher
|
|
@@ -40,7 +41,7 @@ var FTTracking = /** @class */ (function () {
|
|
|
40
41
|
this.scrollTracker = new scroll_1.ScrollTracker(this);
|
|
41
42
|
//cookie consent monitor for permutive tracking
|
|
42
43
|
window.addEventListener("load", function () {
|
|
43
|
-
new consentMonitor_1.
|
|
44
|
+
new consentMonitor_1.ConsentMonitor(window.location.hostname, [".app", "preview"]);
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
Object.defineProperty(FTTracking.prototype, "config", {
|
|
@@ -56,7 +57,7 @@ var FTTracking = /** @class */ (function () {
|
|
|
56
57
|
});
|
|
57
58
|
FTTracking.prototype.newPageView = function (config) {
|
|
58
59
|
//Update passed config to otracker,send pageview events and reset scrollTracker
|
|
59
|
-
(0, yupValidator_1.validateConfig)(config, this.disableAppFormatTransform);
|
|
60
|
+
(0, yupValidator_1.validateConfig)(config, this.disableAppFormatTransform, this.logValidationErrors);
|
|
60
61
|
this.oTracker.config = config;
|
|
61
62
|
this.oTracker.broadcastPageView();
|
|
62
63
|
if (this.options.sendBrandedContent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/FTTracking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/FTTracking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAAqE;AACrE,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;I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AG,CAAC,CAAC;QAC3B,CAAC;;;OAAA;IAKM,gCAAW,GAAlB,UAAmB,MAAkB;QACnC,+EAA+E;QAC/E,IAAA,6BAAc,EACZ,MAAM,EACN,IAAI,CAAC,yBAAyB,EAC9B,IAAI,CAAC,mBAAmB,CACzB,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,OAAO,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,AA9DD,IA8DC;AA9DY,gCAAU"}
|
|
@@ -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
|
+
? "no-referrer-when-downgrade" // production hosts
|
|
16
|
+
: "origin"; // 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,4BAA4B,CAAC,mBAAmB;YAClD,CAAC,CAAC,QAAQ,CAAC,CAAC,sBAAsB;QAEpC,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,IAAI,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAE/C,MAAM,CAAC,IAAI,CAAC,KAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
export declare class
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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[]
|
|
7
|
+
get devHosts(): string[];
|
|
10
8
|
get isDevEnvironment(): boolean;
|
|
11
9
|
get isInitialized(): boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
permutiveConsentOff: () => void;
|
|
10
|
+
get userHasConsented(): boolean;
|
|
11
|
+
constructor(hostname?: string, devHosts?: string[] | string);
|
|
12
|
+
private attachCmpListeners;
|
|
13
|
+
private enablePermutive;
|
|
14
|
+
private disablePermutive;
|
|
18
15
|
}
|
|
16
|
+
export { ConsentMonitor as consentMonitor };
|
|
19
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consentMonitor/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consentMonitor/index.ts"],"names":[],"mappings":"AA0BA,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;gBAEW,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM;IAsB3D,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,gBAAgB;CAMzB;AAED,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,117 +1,130 @@
|
|
|
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;
|
|
7
16
|
var debug_1 = __importDefault(require("debug"));
|
|
8
|
-
var
|
|
17
|
+
var loadFtCmp_1 = require("../cmp/loadFtCmp");
|
|
18
|
+
var debug = (0, debug_1.default)("@phantomstudios/ft-lib/consentMonitor");
|
|
9
19
|
var DEFAULT_DEV_HOSTS = ["localhost", "phq", ".app", "preview"];
|
|
10
|
-
var
|
|
11
|
-
|
|
20
|
+
var CMP_CHOICE_ACCEPT_ALL = 11;
|
|
21
|
+
var CMP_CHOICE_REJECT_ALL = 13;
|
|
22
|
+
var ConsentMonitor = /** @class */ (function () {
|
|
23
|
+
function ConsentMonitor(hostname, devHosts) {
|
|
12
24
|
var _this = this;
|
|
13
25
|
this._consent = false;
|
|
14
26
|
this._isDevEnvironment = false;
|
|
15
27
|
this._isInitialized = false;
|
|
16
|
-
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
|
-
};
|
|
25
|
-
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
|
-
}
|
|
46
|
-
}
|
|
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);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
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
28
|
if (Array.isArray(devHosts)) {
|
|
74
|
-
this._devHosts = devHosts
|
|
29
|
+
this._devHosts = __spreadArray(__spreadArray([], devHosts, true), DEFAULT_DEV_HOSTS, true);
|
|
75
30
|
}
|
|
76
31
|
else if (devHosts === undefined) {
|
|
77
|
-
this._devHosts = DEFAULT_DEV_HOSTS;
|
|
32
|
+
this._devHosts = __spreadArray([], DEFAULT_DEV_HOSTS, true);
|
|
78
33
|
}
|
|
79
34
|
else {
|
|
80
|
-
this._devHosts = DEFAULT_DEV_HOSTS;
|
|
81
|
-
this._devHosts.push(devHosts);
|
|
35
|
+
this._devHosts = __spreadArray(__spreadArray([], DEFAULT_DEV_HOSTS, true), [devHosts], false);
|
|
82
36
|
}
|
|
83
|
-
|
|
84
|
-
this.
|
|
37
|
+
var hostToCheck = hostname !== null && hostname !== void 0 ? hostname : window.location.hostname;
|
|
38
|
+
this._isDevEnvironment = this._devHosts.some(function (h) {
|
|
39
|
+
return hostToCheck.includes(h);
|
|
40
|
+
});
|
|
41
|
+
(0, loadFtCmp_1.loadFtCmpScript)()
|
|
42
|
+
.then(function () {
|
|
43
|
+
_this.attachCmpListeners();
|
|
44
|
+
_this._isInitialized = true;
|
|
45
|
+
})
|
|
46
|
+
.catch(function (err) { return console.error(err); });
|
|
85
47
|
}
|
|
86
|
-
Object.defineProperty(
|
|
48
|
+
Object.defineProperty(ConsentMonitor.prototype, "consent", {
|
|
87
49
|
get: function () {
|
|
88
50
|
return this._consent;
|
|
89
51
|
},
|
|
90
52
|
enumerable: false,
|
|
91
53
|
configurable: true
|
|
92
54
|
});
|
|
93
|
-
Object.defineProperty(
|
|
55
|
+
Object.defineProperty(ConsentMonitor.prototype, "devHosts", {
|
|
94
56
|
get: function () {
|
|
95
57
|
return this._devHosts;
|
|
96
58
|
},
|
|
97
59
|
enumerable: false,
|
|
98
60
|
configurable: true
|
|
99
61
|
});
|
|
100
|
-
Object.defineProperty(
|
|
62
|
+
Object.defineProperty(ConsentMonitor.prototype, "isDevEnvironment", {
|
|
101
63
|
get: function () {
|
|
102
64
|
return this._isDevEnvironment;
|
|
103
65
|
},
|
|
104
66
|
enumerable: false,
|
|
105
67
|
configurable: true
|
|
106
68
|
});
|
|
107
|
-
Object.defineProperty(
|
|
69
|
+
Object.defineProperty(ConsentMonitor.prototype, "isInitialized", {
|
|
108
70
|
get: function () {
|
|
109
71
|
return this._isInitialized;
|
|
110
72
|
},
|
|
111
73
|
enumerable: false,
|
|
112
74
|
configurable: true
|
|
113
75
|
});
|
|
114
|
-
|
|
76
|
+
Object.defineProperty(ConsentMonitor.prototype, "userHasConsented", {
|
|
77
|
+
get: function () {
|
|
78
|
+
return this._consent;
|
|
79
|
+
},
|
|
80
|
+
enumerable: false,
|
|
81
|
+
configurable: true
|
|
82
|
+
});
|
|
83
|
+
ConsentMonitor.prototype.attachCmpListeners = function () {
|
|
84
|
+
var _this = this;
|
|
85
|
+
(0, loadFtCmp_1.enqueueCmpCallback)(function () {
|
|
86
|
+
var _a, _b, _d, _e;
|
|
87
|
+
var onReady = function (_l, _u, _t, info) {
|
|
88
|
+
debug("onConsentReady:", info);
|
|
89
|
+
if (info.consentedToAll) {
|
|
90
|
+
_this.enablePermutive();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
_this.disablePermutive();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var onChoice = function (_l, _c, typeId) {
|
|
97
|
+
debug("onMessageChoiceSelect:", typeId);
|
|
98
|
+
if (typeId === CMP_CHOICE_ACCEPT_ALL)
|
|
99
|
+
_this.enablePermutive();
|
|
100
|
+
else if (typeId === CMP_CHOICE_REJECT_ALL)
|
|
101
|
+
_this.disablePermutive();
|
|
102
|
+
};
|
|
103
|
+
(_b = (_a = window._sp_).addEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "onConsentReady", onReady);
|
|
104
|
+
(_e = (_d = window._sp_).addEventListener) === null || _e === void 0 ? void 0 : _e.call(_d, "onMessageChoiceSelect", onChoice);
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
ConsentMonitor.prototype.enablePermutive = function () {
|
|
108
|
+
var _a;
|
|
109
|
+
if (this._consent)
|
|
110
|
+
return;
|
|
111
|
+
debug("Permutive consent: ON");
|
|
112
|
+
(_a = window.permutive) === null || _a === void 0 ? void 0 : _a.consent({
|
|
113
|
+
opt_in: true,
|
|
114
|
+
token: "behaviouraladsOnsite:on",
|
|
115
|
+
});
|
|
116
|
+
this._consent = true;
|
|
117
|
+
};
|
|
118
|
+
ConsentMonitor.prototype.disablePermutive = function () {
|
|
119
|
+
var _a;
|
|
120
|
+
if (!this._consent)
|
|
121
|
+
return;
|
|
122
|
+
debug("Permutive consent: OFF");
|
|
123
|
+
(_a = window.permutive) === null || _a === void 0 ? void 0 : _a.consent({ opt_in: false });
|
|
124
|
+
this._consent = false;
|
|
125
|
+
};
|
|
126
|
+
return ConsentMonitor;
|
|
115
127
|
}());
|
|
116
|
-
exports.
|
|
128
|
+
exports.ConsentMonitor = ConsentMonitor;
|
|
129
|
+
exports.consentMonitor = ConsentMonitor;
|
|
117
130
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consentMonitor/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consentMonitor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B,8CAAuE;AAEvE,IAAM,KAAK,GAAG,IAAA,eAAK,EAAC,uCAAuC,CAAC,CAAC;AAE7D,IAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAiBlE,IAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,IAAM,qBAA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,CAAC;YACxB,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,yBAAyB;SACjC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAEO,yCAAgB,GAAxB;;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC3B,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAChC,MAAA,MAAM,CAAC,SAAS,0CAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IACH,qBAAC;AAAD,CAAC,AAnFD,IAmFC;AAnFY,wCAAc;AAqFA,wCAAc"}
|
package/lib/gaTracker/index.js
CHANGED
|
@@ -51,8 +51,7 @@ var gaTracker = /** @class */ (function () {
|
|
|
51
51
|
var _a = gaEventString.split("|"), category = _a[0], action = _a[1], label = _a[2];
|
|
52
52
|
if (typeof window !== "undefined") {
|
|
53
53
|
if (_this.options.isCustomGTMEvent) {
|
|
54
|
-
_this.GTMEventDispatcher(category, action, label || window.location.pathname
|
|
55
|
-
);
|
|
54
|
+
_this.GTMEventDispatcher(category, action, label || window.location.pathname);
|
|
56
55
|
}
|
|
57
56
|
else {
|
|
58
57
|
_this.GtagEventDispatcher(category, action, label || window.location.pathname);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gaTracker/index.ts"],"names":[],"mappings":";;;AACA,IAAM,eAAe,GAAG,QAAQ,CAAC;AACjC,IAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAEnD;IAEE,mBAAY,OAAwB;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,8BAA8B,EAAE,CAAC;QACtC,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,IAAI,CAAC,+BAA+B,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;QAC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