@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.
- 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/.nvmrc +1 -1
- 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 +3 -0
- package/lib/FTTracking/index.d.ts.map +1 -1
- package/lib/FTTracking/index.js +14 -1
- 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 -12
- package/lib/consentMonitor/index.d.ts.map +1 -1
- package/lib/consentMonitor/index.js +111 -68
- 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.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.map +1 -1
- package/lib/utils/yupValidator.js +2 -2
- 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 +27 -17
- package/src/FTTracking/index.ts +21 -4
- package/src/cmp/loadFtCmp.ts +28 -0
- package/src/consentMonitor/index.ts +108 -85
- package/src/gaTracker/index.ts +4 -4
- package/src/index.ts +10 -3
- package/src/oTracker/index.ts +5 -5
- package/src/permutiveVideoUtils/index.ts +2 -2
- package/src/reactPlayerTracking/index.ts +4 -4
- package/src/types.d.ts +24 -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 +6 -6
- package/src/ytIframeTracking/index.ts +9 -9
- package/test/index.test.tsx +13 -12
- package/tsconfig.json +3 -1
- package/.eslintrc +0 -58
package/test/index.test.tsx
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as cmpLoader from "../src/cmp/loadFtCmp";
|
|
6
|
+
import { ConsentMonitor, consentMonitor } from "../src/consentMonitor";
|
|
2
7
|
import { permutiveVideoUtils } from "../src/permutiveVideoUtils";
|
|
3
8
|
|
|
4
9
|
let windowSpy: jest.SpyInstance;
|
|
5
10
|
|
|
11
|
+
jest.spyOn(cmpLoader, "loadFtCmpScript").mockResolvedValue(undefined);
|
|
12
|
+
|
|
6
13
|
beforeEach(() => {
|
|
7
14
|
windowSpy = jest.spyOn(window, "window", "get");
|
|
8
15
|
});
|
|
@@ -30,23 +37,17 @@ describe("consentMonitor", () => {
|
|
|
30
37
|
expect(obj.isDevEnvironment).toBe(true);
|
|
31
38
|
});
|
|
32
39
|
|
|
33
|
-
it("Initializes correctly", async () => {
|
|
34
|
-
|
|
35
|
-
windowSpy.mockImplementation(() => ({
|
|
36
|
-
permutive: {
|
|
37
|
-
consent: ({}) => {
|
|
38
|
-
return {};
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
}));
|
|
42
|
-
const obj = new consentMonitor("https://FT-staging.devhost.com", [
|
|
40
|
+
it("Initializes correctly and sets the isInitialized flag", async () => {
|
|
41
|
+
const obj = new ConsentMonitor("https://FT-staging.devhost.com", [
|
|
43
42
|
"localhost",
|
|
44
|
-
"vercel.app",
|
|
45
43
|
"phq",
|
|
46
44
|
"devhost",
|
|
47
45
|
]);
|
|
46
|
+
|
|
47
|
+
await new Promise(process.nextTick);
|
|
48
48
|
expect(obj.isInitialized).toBe(true);
|
|
49
49
|
});
|
|
50
|
+
|
|
50
51
|
//TODO - mock document.cookie get/set and test consent value
|
|
51
52
|
describe("Permutive video progress utils", () => {
|
|
52
53
|
it("can be initiated", () => {
|
package/tsconfig.json
CHANGED
package/.eslintrc
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"node": true,
|
|
5
|
-
"es6": true,
|
|
6
|
-
"jest": true
|
|
7
|
-
},
|
|
8
|
-
"parser": "@typescript-eslint/parser",
|
|
9
|
-
"parserOptions": {
|
|
10
|
-
"jsx": true,
|
|
11
|
-
"useJSXTextNode": true
|
|
12
|
-
},
|
|
13
|
-
"settings": {
|
|
14
|
-
"react": {
|
|
15
|
-
"version": "detect"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"plugins": ["prettier", "eslint-plugin-import"],
|
|
19
|
-
"extends": [
|
|
20
|
-
"plugin:react/recommended",
|
|
21
|
-
"plugin:react-hooks/recommended",
|
|
22
|
-
"plugin:@typescript-eslint/recommended",
|
|
23
|
-
"plugin:prettier/recommended"
|
|
24
|
-
],
|
|
25
|
-
"rules": {
|
|
26
|
-
"react-hooks/rules-of-hooks": "error",
|
|
27
|
-
"react-hooks/exhaustive-deps": "error",
|
|
28
|
-
"react/react-in-jsx-scope": "off",
|
|
29
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
30
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
31
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
|
32
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
33
|
-
"react/prop-types": "off",
|
|
34
|
-
"import/order": [
|
|
35
|
-
"error",
|
|
36
|
-
{
|
|
37
|
-
"groups": ["builtin", "external", "internal"],
|
|
38
|
-
"pathGroups": [
|
|
39
|
-
{
|
|
40
|
-
"pattern": "react",
|
|
41
|
-
"group": "external",
|
|
42
|
-
"position": "before"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"pathGroupsExcludedImportTypes": ["react"],
|
|
46
|
-
"newlines-between": "always",
|
|
47
|
-
"alphabetize": {
|
|
48
|
-
"order": "asc",
|
|
49
|
-
"caseInsensitive": true
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"prettier/prettier": "error"
|
|
54
|
-
},
|
|
55
|
-
"globals": {
|
|
56
|
-
"React": "writable"
|
|
57
|
-
}
|
|
58
|
-
}
|