@duckduckgo/autoconsent 16.28.0 → 16.30.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/CHANGELOG.md +34 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +17 -5
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rule-index.json +1 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +17 -5
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rule-index.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +17 -5
- package/dist/autoconsent.esm.js +17 -5
- package/dist/autoconsent.playwright.js +17 -5
- package/dist/autoconsent.standalone.js +18 -6
- package/dist/types/cmps/base.d.ts +1 -1
- package/dist/types/dom-actions.d.ts +2 -1
- package/dist/types/rules.d.ts +10 -0
- package/dist/types/types.d.ts +1 -1
- package/docs/rule-syntax.md +12 -1
- package/lib/cmps/base.ts +3 -3
- package/lib/dom-actions.ts +26 -2
- package/lib/rules.ts +10 -0
- package/lib/types.ts +7 -1
- package/package.json +1 -1
- package/rules/autoconsent/bankmillennium-pl.json +26 -0
- package/rules/autoconsent/bibliotheek-nl.json +33 -0
- package/rules/autoconsent/ecbeing.json +10 -0
- package/rules/autoconsent/r42-cookiebar.json +37 -0
- package/rules/autoconsent/stright.json +29 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rule-index.json +1 -1
- package/rules/rules.json +1 -1
- package/tests/bankmillennium-pl.spec.ts +5 -0
- package/tests/bibliotheek-nl.spec.ts +3 -0
- package/tests/ecbeing.spec.ts +3 -0
- package/tests/r42-cookiebar.spec.ts +7 -0
- package/tests/stright.spec.ts +8 -0
- package/tests-wtr/dom-actions/dom-actions.wait-for-then-click.html +14 -0
- package/tests-wtr/dom-actions/dom-actions.wait-for-then-click.ts +106 -0
- package/tests-wtr/rules/cmp-test-urls.json +0 -2
- package/rules/generated/auto_NL_averoachmea.nl_fxj.json +0 -40
- package/rules/generated/auto_NL_centraalbeheer.nl_ooy.json +0 -40
- package/tests/generated/auto_NL_averoachmea.nl_fxj.spec.ts +0 -6
- package/tests/generated/auto_NL_centraalbeheer.nl_ooy.spec.ts +0 -6
|
@@ -1462,12 +1462,12 @@
|
|
|
1462
1462
|
waitForVisible(selector, timeout, check) {
|
|
1463
1463
|
return this.autoconsent.domActions.waitForVisible(selector, timeout, check);
|
|
1464
1464
|
}
|
|
1465
|
-
async waitForThenClick(selector, timeout, all) {
|
|
1465
|
+
async waitForThenClick(selector, timeout, all, retries, retryInterval) {
|
|
1466
1466
|
if (this.autoconsent.config.visualTest) {
|
|
1467
1467
|
await this.highlightElements(this.elementSelector(selector), all);
|
|
1468
1468
|
}
|
|
1469
1469
|
this.autoconsent.updateState({ clicks: this.autoconsent.state.clicks + 1 });
|
|
1470
|
-
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all);
|
|
1470
|
+
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all, retries, retryInterval);
|
|
1471
1471
|
}
|
|
1472
1472
|
wait(ms) {
|
|
1473
1473
|
return this.autoconsent.domActions.wait(ms);
|
|
@@ -1591,7 +1591,7 @@
|
|
|
1591
1591
|
results.push(this.click(rule.click, rule.all));
|
|
1592
1592
|
}
|
|
1593
1593
|
if (rule.waitForThenClick) {
|
|
1594
|
-
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
1594
|
+
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all, rule.retry, rule.retryInterval));
|
|
1595
1595
|
}
|
|
1596
1596
|
if (rule.wait) {
|
|
1597
1597
|
results.push(this.wait(rule.wait));
|
|
@@ -2553,6 +2553,8 @@
|
|
|
2553
2553
|
];
|
|
2554
2554
|
|
|
2555
2555
|
// lib/dom-actions.ts
|
|
2556
|
+
var DEFAULT_CLICK_RETRY_INTERVAL = 300;
|
|
2557
|
+
var CLICK_RETRY_POLL_INTERVAL = 50;
|
|
2556
2558
|
var DomActions = class {
|
|
2557
2559
|
constructor(autoconsentInstance) {
|
|
2558
2560
|
this.autoconsentInstance = autoconsentInstance;
|
|
@@ -2608,9 +2610,19 @@
|
|
|
2608
2610
|
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForVisible]", selector);
|
|
2609
2611
|
return waitFor(() => this.elementVisible(selector, check), times, interval);
|
|
2610
2612
|
}
|
|
2611
|
-
async waitForThenClick(selector, timeout = 1e4, all = false) {
|
|
2613
|
+
async waitForThenClick(selector, timeout = 1e4, all = false, retries = 0, retryInterval = DEFAULT_CLICK_RETRY_INTERVAL) {
|
|
2612
2614
|
await this.waitForElement(selector, timeout);
|
|
2613
|
-
|
|
2615
|
+
let clicked = await this.click(selector, all);
|
|
2616
|
+
for (let attempt = 0; clicked && attempt < retries; attempt++) {
|
|
2617
|
+
const pollTimes = Math.ceil(retryInterval / CLICK_RETRY_POLL_INTERVAL);
|
|
2618
|
+
const isGone = await waitFor(() => !this.elementVisible(selector, "any"), pollTimes, CLICK_RETRY_POLL_INTERVAL);
|
|
2619
|
+
if (isGone) {
|
|
2620
|
+
break;
|
|
2621
|
+
}
|
|
2622
|
+
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForThenClick] retrying click", selector);
|
|
2623
|
+
clicked = await this.click(selector, all);
|
|
2624
|
+
}
|
|
2625
|
+
return clicked;
|
|
2614
2626
|
}
|
|
2615
2627
|
wait(ms) {
|
|
2616
2628
|
this.autoconsentInstance.config.logs.rulesteps && this.autoconsentInstance.config.logs.waits && console.log("[wait]", ms);
|