@duckduckgo/autoconsent 1.0.6 → 2.0.0
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/.eslintrc.cjs +14 -0
- package/.vscode/settings.json +7 -0
- package/Jenkinsfile +68 -39
- package/api.md +104 -0
- package/dist/autoconsent.cjs.js +1 -1371
- package/dist/autoconsent.esm.js +1 -1363
- package/dist/autoconsent.playwright.js +1 -0
- package/dist/autoconsent.standalone.js +1 -0
- package/lib/cmps/all.ts +15 -10
- package/lib/cmps/base.ts +91 -91
- package/lib/cmps/consentmanager.ts +31 -19
- package/lib/cmps/consentomatic.ts +89 -0
- package/lib/cmps/cookiebot.ts +62 -53
- package/lib/cmps/evidon.ts +29 -18
- package/lib/cmps/onetrust.ts +37 -19
- package/lib/cmps/sourcepoint-frame.ts +102 -0
- package/lib/cmps/sourcepoint-top.ts +47 -0
- package/lib/cmps/trustarc-frame.ts +115 -0
- package/lib/cmps/trustarc-top.ts +91 -0
- package/lib/consentomatic/index.ts +233 -70
- package/lib/{web/consentomatic → consentomatic}/tools.ts +0 -0
- package/lib/eval-handler.ts +58 -0
- package/lib/index.ts +0 -2
- package/lib/messages.ts +100 -0
- package/lib/rule-executors.ts +108 -0
- package/lib/rules.ts +82 -0
- package/lib/types.ts +35 -0
- package/lib/utils.ts +64 -0
- package/lib/web.ts +283 -74
- package/package.json +17 -14
- package/playwright/content.ts +27 -0
- package/playwright/runner.ts +131 -0
- package/playwright/standalone.ts +36 -0
- package/playwright.config.ts +7 -0
- package/readme.md +57 -47
- package/rollup.config.js +23 -15
- package/rules/autoconsent/192.json +17 -0
- package/rules/autoconsent/ausopen.json +7 -0
- package/rules/autoconsent/aws-amazon.json +1 -1
- package/rules/autoconsent/baden-wuerttemberg-de.json +7 -3
- package/rules/autoconsent/bing.json +14 -0
- package/rules/autoconsent/bundesregierung-de.json +6 -2
- package/rules/autoconsent/cc-banner.json +0 -1
- package/rules/autoconsent/cookie-notice.json +0 -1
- package/rules/autoconsent/cookieconsent.json +5 -6
- package/rules/autoconsent/destatis-de.json +0 -1
- package/rules/autoconsent/dunelm.json +18 -0
- package/rules/autoconsent/etsy.json +3 -2
- package/rules/autoconsent/eu-cookie-compliance.json +0 -1
- package/rules/autoconsent/gov-uk.json +10 -0
- package/rules/autoconsent/hl-co-uk.json +8 -9
- package/rules/autoconsent/johnlewis.json +5 -2
- package/rules/autoconsent/marksandspencer.json +7 -0
- package/rules/autoconsent/notice-cookie.json +0 -1
- package/rules/autoconsent/osano.json +0 -1
- package/rules/autoconsent/{paypal-de.json → paypal.json} +6 -2
- package/rules/autoconsent/tealium.json +4 -5
- package/rules/autoconsent/uswitch.json +8 -0
- package/rules/autoconsent/waitrose.json +28 -0
- package/rules/autoconsent/wetransfer.json +7 -0
- package/rules/rules.json +314 -39
- package/tests/192.spec.ts +7 -0
- package/tests/arzt-auskunft.spec.ts +1 -1
- package/tests/asus.spec.ts +1 -1
- package/tests/ausopen.spec.ts +7 -0
- package/tests/aws.amazon.spec.ts +1 -1
- package/tests/baden-wuerttemberg.spec.ts +1 -1
- package/tests/borlabs.spec.ts +1 -1
- package/tests/bundesregierung.spec.ts +5 -2
- package/tests/ccbanner.spec.ts +1 -1
- package/tests/consentmanager.spec.ts +3 -3
- package/tests/cookiebot.spec.ts +8 -1
- package/tests/cookieconsent.spec.ts +1 -1
- package/tests/cookielawinfo.spec.ts +1 -1
- package/tests/cookienotice.spec.ts +1 -1
- package/tests/corona-in-zahlen.spec.ts +1 -1
- package/tests/deepl.spec.ts +1 -1
- package/tests/destatis.spec.ts +1 -1
- package/tests/didomi.spec.ts +6 -2
- package/tests/drupal.spec.ts +8 -0
- package/tests/dunelm.spec.ts +7 -0
- package/tests/etsy.spec.ts +1 -1
- package/tests/eu-cookie-compliance-banner.spec.ts +1 -1
- package/tests/evidon.spec.ts +1 -1
- package/tests/fundingchoices.spec.ts +2 -1
- package/tests/gov-uk.spec.ts +9 -0
- package/tests/hl-co-uk.spec.ts +1 -1
- package/tests/hubspot.spec.ts +1 -1
- package/tests/ionos.spec.ts +1 -1
- package/tests/johnlewis.spec.ts +2 -2
- package/tests/klaro.spec.ts +1 -1
- package/tests/marksandspencer.spec.ts +7 -0
- package/tests/mediamarkt.spec.ts +1 -1
- package/tests/metoffice-gov-uk.spec.ts +1 -1
- package/tests/microsoft.spec.ts +1 -1
- package/tests/moneysavingexpert.spec.ts +1 -1
- package/tests/motor-talk.spec.ts +1 -1
- package/tests/national-lottery.spec.ts +1 -1
- package/tests/netflix.spec.ts +1 -1
- package/tests/nhs.spec.ts +1 -1
- package/tests/notice-cookie.spec.ts +1 -1
- package/tests/obi.spec.ts +1 -1
- package/tests/oil.spec.ts +1 -1
- package/tests/onetrust.spec.ts +10 -1
- package/tests/osano.spec.ts +1 -1
- package/tests/otto.spec.ts +1 -1
- package/tests/paypal.spec.ts +8 -6
- package/tests/quantcast.spec.ts +4 -1
- package/tests/snigel.spec.ts +1 -1
- package/tests/sourcepoint.spec.ts +8 -8
- package/tests/springer.spec.ts +1 -1
- package/tests/steampowered.spec.ts +1 -1
- package/tests/tealium.spec.ts +1 -1
- package/tests/testcmp.spec.ts +1 -1
- package/tests/thalia.spec.ts +1 -1
- package/tests/thefreedictionary.spec.ts +1 -1
- package/tests/trustarc.spec.ts +25 -3
- package/tests/usercentrics-1.spec.ts +1 -1
- package/tests/uswitch.spec.ts +7 -0
- package/tests/vodafone.spec.ts +1 -1
- package/tests/waitrose.spec.ts +7 -0
- package/tests/wetransfer.spec.ts +7 -0
- package/tests/wordpressgdpr.spec.ts +1 -1
- package/tests/xing.spec.ts +1 -1
- package/tsconfig.json +2 -2
- package/.eslintrc +0 -12
- package/cosmetics/rules.json +0 -110
- package/dist/autoconsent.puppet.js +0 -1072
- package/lib/cmps/all.js +0 -19
- package/lib/cmps/base.js +0 -174
- package/lib/cmps/consentmanager.js +0 -31
- package/lib/cmps/cookiebot.js +0 -73
- package/lib/cmps/evidon.js +0 -26
- package/lib/cmps/onetrust.js +0 -32
- package/lib/cmps/sourcepoint.js +0 -82
- package/lib/cmps/sourcepoint.ts +0 -95
- package/lib/cmps/trustarc.js +0 -106
- package/lib/cmps/trustarc.ts +0 -147
- package/lib/config.js +0 -1
- package/lib/consentomatic/index.js +0 -52
- package/lib/detector.js +0 -33
- package/lib/detector.ts +0 -34
- package/lib/hider.js +0 -13
- package/lib/hider.ts +0 -16
- package/lib/index.js +0 -4
- package/lib/messages.d.ts +0 -61
- package/lib/node.js +0 -35
- package/lib/node.ts +0 -43
- package/lib/puppet/tab.js +0 -121
- package/lib/puppet/tab.ts +0 -146
- package/lib/rules.d.ts +0 -80
- package/lib/tabwrapper.js +0 -67
- package/lib/tabwrapper.ts +0 -74
- package/lib/types.d.ts +0 -61
- package/lib/web/consentomatic/index.js +0 -188
- package/lib/web/consentomatic/index.ts +0 -249
- package/lib/web/consentomatic/tools.js +0 -177
- package/lib/web/content-utils.js +0 -29
- package/lib/web/content-utils.ts +0 -31
- package/lib/web/content.js +0 -79
- package/lib/web/content.ts +0 -71
- package/lib/web/tab.js +0 -112
- package/lib/web/tab.ts +0 -178
- package/lib/web.js +0 -95
- package/tests/runner.ts +0 -61
package/lib/cmps/onetrust.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { click, doEval, elementExists, elementVisible, wait, waitForElement } from "../rule-executors";
|
|
2
|
+
import { waitFor } from "../utils";
|
|
3
|
+
import AutoConsentCMPBase from "./base";
|
|
3
4
|
|
|
4
|
-
export default class Onetrust extends
|
|
5
|
+
export default class Onetrust extends AutoConsentCMPBase {
|
|
5
6
|
|
|
6
7
|
prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.optanon-alert-box-wrapper,.onetrust-pc-dark-filter,.js-consent-banner"]
|
|
7
8
|
|
|
@@ -9,33 +10,50 @@ export default class Onetrust extends AutoConsentBase {
|
|
|
9
10
|
super("Onetrust");
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
return
|
|
13
|
+
get hasSelfTest(): boolean {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get isIntermediate(): boolean {
|
|
18
|
+
return false;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
return
|
|
21
|
+
async detectCmp() {
|
|
22
|
+
return elementExists("#onetrust-banner-sdk,.optanon-alert-box-wrapper");
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
async
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
async detectPopup() {
|
|
26
|
+
return elementVisible("#onetrust-banner-sdk,.optanon-alert-box-wrapper", 'all');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async optOut() {
|
|
30
|
+
if (elementExists("#onetrust-pc-btn-handler")) { // "show purposes" button inside a popup
|
|
31
|
+
click("#onetrust-pc-btn-handler");
|
|
23
32
|
} else { // otherwise look for a generic "show settings" button
|
|
24
|
-
|
|
33
|
+
click(".ot-sdk-show-settings,button.js-cookie-settings");
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
await
|
|
28
|
-
await
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
await waitForElement('#onetrust-consent-sdk', 2000);
|
|
37
|
+
await wait(1000);
|
|
38
|
+
click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true); // optional step
|
|
39
|
+
|
|
40
|
+
await waitForElement(".save-preference-btn-handler,.js-consent-save", 2000);
|
|
41
|
+
click(".save-preference-btn-handler,.js-consent-save");
|
|
42
|
+
|
|
43
|
+
// popup doesn't disappear immediately
|
|
44
|
+
await waitFor(
|
|
45
|
+
() => elementVisible("#onetrust-banner-sdk", 'none'),
|
|
46
|
+
10,
|
|
47
|
+
500
|
|
48
|
+
);
|
|
31
49
|
return true;
|
|
32
50
|
}
|
|
33
51
|
|
|
34
|
-
async optIn(
|
|
35
|
-
return
|
|
52
|
+
async optIn() {
|
|
53
|
+
return click("onetrust-accept-btn-handler,js-accept-cookies");
|
|
36
54
|
}
|
|
37
55
|
|
|
38
|
-
async test(
|
|
39
|
-
return
|
|
56
|
+
async test() {
|
|
57
|
+
return await doEval("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1");
|
|
40
58
|
}
|
|
41
59
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { enableLogs } from "../config";
|
|
2
|
+
import { click, elementExists, wait, waitForElement } from "../rule-executors";
|
|
3
|
+
import { RunContext } from "../rules";
|
|
4
|
+
import { waitFor } from "../utils";
|
|
5
|
+
import AutoConsentCMPBase from "./base";
|
|
6
|
+
|
|
7
|
+
export default class SourcePoint extends AutoConsentCMPBase {
|
|
8
|
+
|
|
9
|
+
ccpaMode = false;
|
|
10
|
+
|
|
11
|
+
runContext: RunContext = {
|
|
12
|
+
main: false,
|
|
13
|
+
frame: true,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
super("Sourcepoint-frame");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get hasSelfTest(): boolean {
|
|
21
|
+
return false; // self-test is done by parent frame
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get isIntermediate(): boolean {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async detectCmp() {
|
|
29
|
+
const url = new URL(location.href);
|
|
30
|
+
if (url.searchParams.has('message_id') && url.hostname === 'ccpa-notice.sp-prod.net') {
|
|
31
|
+
this.ccpaMode = true;
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return (url.pathname === '/index.html' || url.pathname === '/privacy-manager/index.html')
|
|
35
|
+
&& url.searchParams.has('message_id') && url.searchParams.has('requestUUID');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async detectPopup() {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async optIn() {
|
|
43
|
+
if (click(".sp_choice_type_11")) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (click('.sp_choice_type_ACCEPT_ALL')) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
isManagerOpen() {
|
|
54
|
+
return (new URL(location.href)).pathname === "/privacy-manager/index.html";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async optOut() {
|
|
58
|
+
if (!this.isManagerOpen()) {
|
|
59
|
+
if (!elementExists("button.sp_choice_type_12")) {
|
|
60
|
+
// do not sell button
|
|
61
|
+
click("button.sp_choice_type_13");
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
click("button.sp_choice_type_12");
|
|
66
|
+
await waitFor(
|
|
67
|
+
() => location.pathname === "/privacy-manager/index.html",
|
|
68
|
+
200,
|
|
69
|
+
100
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
await waitForElement('.type-modal', 20000);
|
|
74
|
+
// reject all button is offered by some sites
|
|
75
|
+
try {
|
|
76
|
+
const rejectSelector1 = '.sp_choice_type_REJECT_ALL';
|
|
77
|
+
const rejectSelector2 = '.reject-toggle';
|
|
78
|
+
const path = await Promise.race([
|
|
79
|
+
waitForElement(rejectSelector1, 2000).then(success => success ? 0: -1),
|
|
80
|
+
waitForElement(rejectSelector2, 2000).then(success => success ? 1: -1),
|
|
81
|
+
waitForElement('.pm-features', 2000).then(success => success ? 2: -1),
|
|
82
|
+
]);
|
|
83
|
+
if (path === 0) {
|
|
84
|
+
await wait(1000);
|
|
85
|
+
click(rejectSelector1);
|
|
86
|
+
return true;
|
|
87
|
+
} else if (path === 1) {
|
|
88
|
+
click(rejectSelector2);
|
|
89
|
+
} else if (path === 2) {
|
|
90
|
+
// TODO: check if this is still working
|
|
91
|
+
await waitForElement('.pm-features', 10000);
|
|
92
|
+
click('.checked > span', true);
|
|
93
|
+
|
|
94
|
+
click('.chevron');
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
enableLogs && console.warn(e);
|
|
98
|
+
}
|
|
99
|
+
click('.sp_choice_type_SAVE_AND_EXIT');
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { doEval, elementExists, elementVisible } from "../rule-executors";
|
|
2
|
+
import { RunContext } from "../rules";
|
|
3
|
+
import AutoConsentCMPBase from "./base";
|
|
4
|
+
|
|
5
|
+
export default class SourcePoint extends AutoConsentCMPBase {
|
|
6
|
+
prehideSelectors = ["div[id^='sp_message_container_'],.message-overlay"]
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
super("Sourcepoint-top");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
runContext: RunContext = {
|
|
13
|
+
main: true,
|
|
14
|
+
frame: false,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get hasSelfTest(): boolean {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get isIntermediate(): boolean {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async detectCmp() {
|
|
26
|
+
return elementExists("div[id^='sp_message_container_']");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async detectPopup() {
|
|
30
|
+
return elementVisible("div[id^='sp_message_container_']", 'all');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async optIn() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async optOut() {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async test() {
|
|
42
|
+
await doEval("__tcfapi('getTCData', 2, r => window.__rcsResult = r)");
|
|
43
|
+
return await doEval(
|
|
44
|
+
"Object.values(window.__rcsResult.purpose.consents).every(c => !c)"
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { click, elementExists, elementVisible, waitForElement } from "../rule-executors";
|
|
2
|
+
import { RunContext } from "../rules";
|
|
3
|
+
import { waitFor } from "../utils";
|
|
4
|
+
import AutoConsentCMPBase from "./base";
|
|
5
|
+
|
|
6
|
+
export default class TrustArcFrame extends AutoConsentCMPBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super("TrustArc-frame");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
runContext: RunContext = {
|
|
12
|
+
main: false,
|
|
13
|
+
frame: true,
|
|
14
|
+
url: "https://consent-pref.trustarc.com/?",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get hasSelfTest(): boolean {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get isIntermediate(): boolean {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async detectCmp() {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async detectPopup() {
|
|
30
|
+
// we're already inside the popup
|
|
31
|
+
return elementVisible("#defaultpreferencemanager", 'any') && elementVisible(".mainContent", 'any');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async navigateToSettings() {
|
|
35
|
+
// wait for it to load
|
|
36
|
+
await waitFor(
|
|
37
|
+
async () => {
|
|
38
|
+
return (
|
|
39
|
+
elementExists(".shp") ||
|
|
40
|
+
elementVisible(".advance", 'any') ||
|
|
41
|
+
elementExists(".switch span:first-child")
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
10,
|
|
45
|
+
500
|
|
46
|
+
);
|
|
47
|
+
// splash screen -> hit more information
|
|
48
|
+
if (elementExists(".shp")) {
|
|
49
|
+
click(".shp");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
await waitForElement(".prefPanel", 5000);
|
|
53
|
+
|
|
54
|
+
// go to advanced settings if not yet shown
|
|
55
|
+
if (elementVisible(".advance", 'any')) {
|
|
56
|
+
click(".advance");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// takes a while to load the opt-in/opt-out buttons
|
|
60
|
+
return await waitFor(
|
|
61
|
+
() => elementVisible(".switch span:first-child", 'any'),
|
|
62
|
+
5,
|
|
63
|
+
1000
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async optOut() {
|
|
68
|
+
await waitFor(() => document.readyState === 'complete', 20, 100);
|
|
69
|
+
await waitForElement(".mainContent[aria-hidden=false]", 5000);
|
|
70
|
+
|
|
71
|
+
if (click(".rejectAll")) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (elementExists('.prefPanel')) {
|
|
76
|
+
await waitForElement('.prefPanel[style="visibility: visible;"]', 3000);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (click("#catDetails0")) {
|
|
80
|
+
click(".submit");
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (click(".required")) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
await this.navigateToSettings();
|
|
89
|
+
|
|
90
|
+
click(".switch span:nth-child(1):not(.active)", true);
|
|
91
|
+
|
|
92
|
+
click(".submit");
|
|
93
|
+
|
|
94
|
+
// at this point, iframe usually closes. Sometimes we need to close manually, but we don't wait for it to report success
|
|
95
|
+
waitForElement("#gwt-debug-close_id", 300000).then(() => {
|
|
96
|
+
click("#gwt-debug-close_id");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async optIn() {
|
|
103
|
+
await this.navigateToSettings();
|
|
104
|
+
click(".switch span:nth-child(2)", true);
|
|
105
|
+
|
|
106
|
+
click(".submit");
|
|
107
|
+
|
|
108
|
+
// at this point, iframe usually closes. Sometimes we need to close manually, but we don't wait for it to report success
|
|
109
|
+
waitForElement("#gwt-debug-close_id", 300000).then(() => {
|
|
110
|
+
click("#gwt-debug-close_id");
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { click, elementExists, elementVisible } from "../rule-executors";
|
|
2
|
+
import { RunContext } from "../rules";
|
|
3
|
+
import { getStyleElement, hideElements } from "../utils";
|
|
4
|
+
import AutoConsentCMPBase from "./base";
|
|
5
|
+
|
|
6
|
+
const cookieSettingsButton = "#truste-show-consent";
|
|
7
|
+
const shortcutOptOut = '#truste-consent-required';
|
|
8
|
+
const shortcutOptIn = '#truste-consent-button';
|
|
9
|
+
const popupContent = '#truste-consent-content';
|
|
10
|
+
const bannerOverlay = '#trustarc-banner-overlay';
|
|
11
|
+
const bannerContainer = '#truste-consent-track';
|
|
12
|
+
|
|
13
|
+
export default class TrustArcTop extends AutoConsentCMPBase {
|
|
14
|
+
|
|
15
|
+
prehideSelectors = [
|
|
16
|
+
".trustarc-banner-container",
|
|
17
|
+
`.truste_popframe,.truste_overlay,.truste_box_overlay,${bannerContainer}`,
|
|
18
|
+
]
|
|
19
|
+
runContext: RunContext = {
|
|
20
|
+
main: true,
|
|
21
|
+
frame: false,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_shortcutButton: HTMLElement;
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
super("TrustArc-top");
|
|
28
|
+
this._shortcutButton = null; // indicates if the "reject all" button is detected
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get hasSelfTest(): boolean {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get isIntermediate(): boolean {
|
|
36
|
+
return !this._shortcutButton;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async detectCmp() {
|
|
40
|
+
const result = elementExists(`${cookieSettingsButton},${bannerContainer}`);
|
|
41
|
+
if (result) {
|
|
42
|
+
// additionally detect the opt-out button
|
|
43
|
+
this._shortcutButton = document.querySelector(shortcutOptOut);
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async detectPopup() {
|
|
49
|
+
// not every element should exist, but if it does, it's a popup
|
|
50
|
+
return elementVisible(`${popupContent},${bannerOverlay},${bannerContainer}`, 'all');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
openFrame() {
|
|
54
|
+
click(cookieSettingsButton);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async optOut() {
|
|
58
|
+
if (this._shortcutButton) {
|
|
59
|
+
this._shortcutButton.click();
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// hide elements permanently, so user doesn't see the popup
|
|
64
|
+
hideElements(
|
|
65
|
+
getStyleElement(),
|
|
66
|
+
[".truste_popframe", ".truste_overlay", ".truste_box_overlay", bannerContainer],
|
|
67
|
+
);
|
|
68
|
+
click(cookieSettingsButton);
|
|
69
|
+
|
|
70
|
+
// schedule cleanup
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
getStyleElement().remove();
|
|
73
|
+
}, 10000);
|
|
74
|
+
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async optIn() {
|
|
79
|
+
return click(shortcutOptIn);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async openCmp() {
|
|
83
|
+
// await tab.eval("truste.eu.clickListener()");
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async test() {
|
|
88
|
+
// TODO: find out how to test TrustArc
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}
|