@duckduckgo/autoconsent 14.82.0 → 14.84.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/AGENTS.md +3 -1
- package/CHANGELOG.md +27 -0
- package/dist/addon-firefox/background.bundle.js +7 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +16 -2
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/popup.bundle.js +20 -0
- package/dist/addon-firefox/popup.html +14 -0
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/background.bundle.js +7 -0
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +16 -2
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/popup.bundle.js +20 -0
- package/dist/addon-mv3/popup.html +14 -0
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +16 -2
- package/dist/autoconsent.esm.js +16 -2
- package/dist/autoconsent.extra.cjs.js +16 -2
- package/dist/autoconsent.extra.esm.js +16 -2
- package/dist/autoconsent.playwright.js +16 -2
- package/dist/types/types.d.ts +1 -0
- package/lib/types.ts +1 -0
- package/lib/utils.ts +1 -0
- package/lib/web.ts +17 -3
- package/package.json +1 -1
- package/rules/autoconsent/escaparium.ca.json +35 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rules.json +1 -1
- package/tests/escaparium.ca.spec.ts +3 -0
- package/tests-wtr/lifecycle/wait-for-popup.html +14 -0
- package/tests-wtr/lifecycle/wait-for-popup.ts +214 -0
package/dist/autoconsent.cjs.js
CHANGED
|
@@ -728,6 +728,7 @@ function normalizeConfig(providedConfig) {
|
|
|
728
728
|
enableGeneratedRules: true,
|
|
729
729
|
enableHeuristicDetection: false,
|
|
730
730
|
enableHeuristicAction: false,
|
|
731
|
+
enablePopupMutationObserver: false,
|
|
731
732
|
detectRetries: 20,
|
|
732
733
|
isMainWorld: false,
|
|
733
734
|
prehideTimeout: 2e3,
|
|
@@ -3963,16 +3964,29 @@ var AutoConsent = class {
|
|
|
3963
3964
|
this.updateState({ selfTest: selfTestResult });
|
|
3964
3965
|
return selfTestResult;
|
|
3965
3966
|
}
|
|
3966
|
-
// TODO: use MutationObserver like in findCmp()
|
|
3967
3967
|
async waitForPopup(cmp, retries = 10, interval = 500) {
|
|
3968
3968
|
const logsConfig = this.config.logs;
|
|
3969
3969
|
logsConfig.lifecycle && console.log("checking if popup is open...", cmp.name);
|
|
3970
|
+
let mutationObserver = null;
|
|
3971
|
+
if (this.config.enablePopupMutationObserver) {
|
|
3972
|
+
mutationObserver = this.domActions.waitForMutation("html", 1e4);
|
|
3973
|
+
mutationObserver.catch(() => {
|
|
3974
|
+
});
|
|
3975
|
+
}
|
|
3970
3976
|
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
3971
3977
|
logsConfig.errors && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
3972
3978
|
return false;
|
|
3973
3979
|
});
|
|
3974
3980
|
if (!isOpen && retries > 0) {
|
|
3975
|
-
|
|
3981
|
+
if (mutationObserver) {
|
|
3982
|
+
try {
|
|
3983
|
+
await Promise.all([this.domActions.wait(interval), mutationObserver]);
|
|
3984
|
+
} catch (e) {
|
|
3985
|
+
logsConfig.lifecycle && console.log(cmp.name, "popup detection timed out waiting for DOM mutation");
|
|
3986
|
+
}
|
|
3987
|
+
} else {
|
|
3988
|
+
await this.domActions.wait(interval);
|
|
3989
|
+
}
|
|
3976
3990
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
3977
3991
|
}
|
|
3978
3992
|
logsConfig.lifecycle && console.log(cmp.name, `popup is ${isOpen ? "open" : "not open"}`);
|
package/dist/autoconsent.esm.js
CHANGED
|
@@ -698,6 +698,7 @@ function normalizeConfig(providedConfig) {
|
|
|
698
698
|
enableGeneratedRules: true,
|
|
699
699
|
enableHeuristicDetection: false,
|
|
700
700
|
enableHeuristicAction: false,
|
|
701
|
+
enablePopupMutationObserver: false,
|
|
701
702
|
detectRetries: 20,
|
|
702
703
|
isMainWorld: false,
|
|
703
704
|
prehideTimeout: 2e3,
|
|
@@ -3933,16 +3934,29 @@ var AutoConsent = class {
|
|
|
3933
3934
|
this.updateState({ selfTest: selfTestResult });
|
|
3934
3935
|
return selfTestResult;
|
|
3935
3936
|
}
|
|
3936
|
-
// TODO: use MutationObserver like in findCmp()
|
|
3937
3937
|
async waitForPopup(cmp, retries = 10, interval = 500) {
|
|
3938
3938
|
const logsConfig = this.config.logs;
|
|
3939
3939
|
logsConfig.lifecycle && console.log("checking if popup is open...", cmp.name);
|
|
3940
|
+
let mutationObserver = null;
|
|
3941
|
+
if (this.config.enablePopupMutationObserver) {
|
|
3942
|
+
mutationObserver = this.domActions.waitForMutation("html", 1e4);
|
|
3943
|
+
mutationObserver.catch(() => {
|
|
3944
|
+
});
|
|
3945
|
+
}
|
|
3940
3946
|
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
3941
3947
|
logsConfig.errors && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
3942
3948
|
return false;
|
|
3943
3949
|
});
|
|
3944
3950
|
if (!isOpen && retries > 0) {
|
|
3945
|
-
|
|
3951
|
+
if (mutationObserver) {
|
|
3952
|
+
try {
|
|
3953
|
+
await Promise.all([this.domActions.wait(interval), mutationObserver]);
|
|
3954
|
+
} catch (e) {
|
|
3955
|
+
logsConfig.lifecycle && console.log(cmp.name, "popup detection timed out waiting for DOM mutation");
|
|
3956
|
+
}
|
|
3957
|
+
} else {
|
|
3958
|
+
await this.domActions.wait(interval);
|
|
3959
|
+
}
|
|
3946
3960
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
3947
3961
|
}
|
|
3948
3962
|
logsConfig.lifecycle && console.log(cmp.name, `popup is ${isOpen ? "open" : "not open"}`);
|
|
@@ -11291,6 +11291,7 @@ function normalizeConfig(providedConfig) {
|
|
|
11291
11291
|
enableGeneratedRules: true,
|
|
11292
11292
|
enableHeuristicDetection: false,
|
|
11293
11293
|
enableHeuristicAction: false,
|
|
11294
|
+
enablePopupMutationObserver: false,
|
|
11294
11295
|
detectRetries: 20,
|
|
11295
11296
|
isMainWorld: false,
|
|
11296
11297
|
prehideTimeout: 2e3,
|
|
@@ -14961,16 +14962,29 @@ var AutoConsent = class {
|
|
|
14961
14962
|
this.updateState({ selfTest: selfTestResult });
|
|
14962
14963
|
return selfTestResult;
|
|
14963
14964
|
}
|
|
14964
|
-
// TODO: use MutationObserver like in findCmp()
|
|
14965
14965
|
async waitForPopup(cmp, retries = 10, interval = 500) {
|
|
14966
14966
|
const logsConfig = this.config.logs;
|
|
14967
14967
|
logsConfig.lifecycle && console.log("checking if popup is open...", cmp.name);
|
|
14968
|
+
let mutationObserver = null;
|
|
14969
|
+
if (this.config.enablePopupMutationObserver) {
|
|
14970
|
+
mutationObserver = this.domActions.waitForMutation("html", 1e4);
|
|
14971
|
+
mutationObserver.catch(() => {
|
|
14972
|
+
});
|
|
14973
|
+
}
|
|
14968
14974
|
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
14969
14975
|
logsConfig.errors && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
14970
14976
|
return false;
|
|
14971
14977
|
});
|
|
14972
14978
|
if (!isOpen && retries > 0) {
|
|
14973
|
-
|
|
14979
|
+
if (mutationObserver) {
|
|
14980
|
+
try {
|
|
14981
|
+
await Promise.all([this.domActions.wait(interval), mutationObserver]);
|
|
14982
|
+
} catch (e) {
|
|
14983
|
+
logsConfig.lifecycle && console.log(cmp.name, "popup detection timed out waiting for DOM mutation");
|
|
14984
|
+
}
|
|
14985
|
+
} else {
|
|
14986
|
+
await this.domActions.wait(interval);
|
|
14987
|
+
}
|
|
14974
14988
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
14975
14989
|
}
|
|
14976
14990
|
logsConfig.lifecycle && console.log(cmp.name, `popup is ${isOpen ? "open" : "not open"}`);
|
|
@@ -11225,6 +11225,7 @@ function normalizeConfig(providedConfig) {
|
|
|
11225
11225
|
enableGeneratedRules: true,
|
|
11226
11226
|
enableHeuristicDetection: false,
|
|
11227
11227
|
enableHeuristicAction: false,
|
|
11228
|
+
enablePopupMutationObserver: false,
|
|
11228
11229
|
detectRetries: 20,
|
|
11229
11230
|
isMainWorld: false,
|
|
11230
11231
|
prehideTimeout: 2e3,
|
|
@@ -14895,16 +14896,29 @@ var AutoConsent = class {
|
|
|
14895
14896
|
this.updateState({ selfTest: selfTestResult });
|
|
14896
14897
|
return selfTestResult;
|
|
14897
14898
|
}
|
|
14898
|
-
// TODO: use MutationObserver like in findCmp()
|
|
14899
14899
|
async waitForPopup(cmp, retries = 10, interval = 500) {
|
|
14900
14900
|
const logsConfig = this.config.logs;
|
|
14901
14901
|
logsConfig.lifecycle && console.log("checking if popup is open...", cmp.name);
|
|
14902
|
+
let mutationObserver = null;
|
|
14903
|
+
if (this.config.enablePopupMutationObserver) {
|
|
14904
|
+
mutationObserver = this.domActions.waitForMutation("html", 1e4);
|
|
14905
|
+
mutationObserver.catch(() => {
|
|
14906
|
+
});
|
|
14907
|
+
}
|
|
14902
14908
|
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
14903
14909
|
logsConfig.errors && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
14904
14910
|
return false;
|
|
14905
14911
|
});
|
|
14906
14912
|
if (!isOpen && retries > 0) {
|
|
14907
|
-
|
|
14913
|
+
if (mutationObserver) {
|
|
14914
|
+
try {
|
|
14915
|
+
await Promise.all([this.domActions.wait(interval), mutationObserver]);
|
|
14916
|
+
} catch (e) {
|
|
14917
|
+
logsConfig.lifecycle && console.log(cmp.name, "popup detection timed out waiting for DOM mutation");
|
|
14918
|
+
}
|
|
14919
|
+
} else {
|
|
14920
|
+
await this.domActions.wait(interval);
|
|
14921
|
+
}
|
|
14908
14922
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
14909
14923
|
}
|
|
14910
14924
|
logsConfig.lifecycle && console.log(cmp.name, `popup is ${isOpen ? "open" : "not open"}`);
|
|
@@ -700,6 +700,7 @@
|
|
|
700
700
|
enableGeneratedRules: true,
|
|
701
701
|
enableHeuristicDetection: false,
|
|
702
702
|
enableHeuristicAction: false,
|
|
703
|
+
enablePopupMutationObserver: false,
|
|
703
704
|
detectRetries: 20,
|
|
704
705
|
isMainWorld: false,
|
|
705
706
|
prehideTimeout: 2e3,
|
|
@@ -3703,16 +3704,29 @@
|
|
|
3703
3704
|
this.updateState({ selfTest: selfTestResult });
|
|
3704
3705
|
return selfTestResult;
|
|
3705
3706
|
}
|
|
3706
|
-
// TODO: use MutationObserver like in findCmp()
|
|
3707
3707
|
async waitForPopup(cmp, retries = 10, interval = 500) {
|
|
3708
3708
|
const logsConfig = this.config.logs;
|
|
3709
3709
|
logsConfig.lifecycle && console.log("checking if popup is open...", cmp.name);
|
|
3710
|
+
let mutationObserver = null;
|
|
3711
|
+
if (this.config.enablePopupMutationObserver) {
|
|
3712
|
+
mutationObserver = this.domActions.waitForMutation("html", 1e4);
|
|
3713
|
+
mutationObserver.catch(() => {
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3710
3716
|
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
3711
3717
|
logsConfig.errors && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
3712
3718
|
return false;
|
|
3713
3719
|
});
|
|
3714
3720
|
if (!isOpen && retries > 0) {
|
|
3715
|
-
|
|
3721
|
+
if (mutationObserver) {
|
|
3722
|
+
try {
|
|
3723
|
+
await Promise.all([this.domActions.wait(interval), mutationObserver]);
|
|
3724
|
+
} catch (e) {
|
|
3725
|
+
logsConfig.lifecycle && console.log(cmp.name, "popup detection timed out waiting for DOM mutation");
|
|
3726
|
+
}
|
|
3727
|
+
} else {
|
|
3728
|
+
await this.domActions.wait(interval);
|
|
3729
|
+
}
|
|
3716
3730
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
3717
3731
|
}
|
|
3718
3732
|
logsConfig.lifecycle && console.log(cmp.name, `popup is ${isOpen ? "open" : "not open"}`);
|
package/dist/types/types.d.ts
CHANGED
package/lib/types.ts
CHANGED
|
@@ -65,6 +65,7 @@ export type Config = {
|
|
|
65
65
|
enableFilterList: boolean;
|
|
66
66
|
enableHeuristicDetection: boolean;
|
|
67
67
|
enableHeuristicAction: boolean;
|
|
68
|
+
enablePopupMutationObserver: boolean;
|
|
68
69
|
visualTest: boolean; // If true, the script will delay before every click action
|
|
69
70
|
logs: {
|
|
70
71
|
lifecycle: boolean;
|
package/lib/utils.ts
CHANGED
|
@@ -78,6 +78,7 @@ export function normalizeConfig(providedConfig: any): Config {
|
|
|
78
78
|
enableGeneratedRules: true,
|
|
79
79
|
enableHeuristicDetection: false,
|
|
80
80
|
enableHeuristicAction: false,
|
|
81
|
+
enablePopupMutationObserver: false,
|
|
81
82
|
detectRetries: 20,
|
|
82
83
|
isMainWorld: false,
|
|
83
84
|
prehideTimeout: 2000,
|
package/lib/web.ts
CHANGED
|
@@ -553,16 +553,30 @@ export default class AutoConsent {
|
|
|
553
553
|
return selfTestResult;
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
-
// TODO: use MutationObserver like in findCmp()
|
|
557
556
|
async waitForPopup(cmp: AutoCMP, retries = 10, interval = 500): Promise<boolean> {
|
|
558
557
|
const logsConfig = this.config.logs;
|
|
559
558
|
logsConfig.lifecycle && console.log('checking if popup is open...', cmp.name);
|
|
559
|
+
|
|
560
|
+
let mutationObserver: Promise<boolean> | null = null;
|
|
561
|
+
if (this.config.enablePopupMutationObserver) {
|
|
562
|
+
mutationObserver = this.domActions.waitForMutation('html', 10000);
|
|
563
|
+
mutationObserver.catch(() => {});
|
|
564
|
+
}
|
|
565
|
+
|
|
560
566
|
const isOpen = await cmp.detectPopup().catch((e) => {
|
|
561
567
|
logsConfig.errors && console.warn(`error detecting popup for ${cmp.name}`, e);
|
|
562
568
|
return false;
|
|
563
|
-
});
|
|
569
|
+
});
|
|
564
570
|
if (!isOpen && retries > 0) {
|
|
565
|
-
|
|
571
|
+
if (mutationObserver) {
|
|
572
|
+
try {
|
|
573
|
+
await Promise.all([this.domActions.wait(interval), mutationObserver]);
|
|
574
|
+
} catch (e) {
|
|
575
|
+
logsConfig.lifecycle && console.log(cmp.name, 'popup detection timed out waiting for DOM mutation');
|
|
576
|
+
}
|
|
577
|
+
} else {
|
|
578
|
+
await this.domActions.wait(interval);
|
|
579
|
+
}
|
|
566
580
|
return this.waitForPopup(cmp, retries - 1, interval);
|
|
567
581
|
}
|
|
568
582
|
logsConfig.lifecycle && console.log(cmp.name, `popup is ${isOpen ? 'open' : 'not open'}`);
|
package/package.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "escaparium.ca",
|
|
3
|
+
"vendorUrl": "https://www.escaparium.ca/",
|
|
4
|
+
"runContext": {
|
|
5
|
+
"urlPattern": "^https://(www\\.)?escaparium\\.ca/"
|
|
6
|
+
},
|
|
7
|
+
"detectCmp": [
|
|
8
|
+
{
|
|
9
|
+
"exists": "div#klaro"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"detectPopup": [
|
|
13
|
+
{
|
|
14
|
+
"visible": "xpath///div[contains(@class,'pointer-events-none')]//button[normalize-space()='Accept all' or normalize-space()='Tout accepter']"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"optIn": [
|
|
18
|
+
{
|
|
19
|
+
"waitForThenClick": "xpath///button[normalize-space()='Accept all' or normalize-space()='Tout accepter']"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"optOut": [
|
|
23
|
+
{
|
|
24
|
+
"waitForThenClick": "xpath///button[normalize-space()='Customize' or normalize-space()='Personnaliser']"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"waitForThenClick": "xpath///button[normalize-space()='Decline' or normalize-space()='Refuser']"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"test": [
|
|
31
|
+
{
|
|
32
|
+
"cookieContains": "escaparium_cookie_consent_decided=1"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|