@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
package/dist/autoconsent.cjs.js
CHANGED
|
@@ -1498,12 +1498,12 @@ var AutoConsentCMPBase = class {
|
|
|
1498
1498
|
waitForVisible(selector, timeout, check) {
|
|
1499
1499
|
return this.autoconsent.domActions.waitForVisible(selector, timeout, check);
|
|
1500
1500
|
}
|
|
1501
|
-
async waitForThenClick(selector, timeout, all) {
|
|
1501
|
+
async waitForThenClick(selector, timeout, all, retries, retryInterval) {
|
|
1502
1502
|
if (this.autoconsent.config.visualTest) {
|
|
1503
1503
|
await this.highlightElements(this.elementSelector(selector), all);
|
|
1504
1504
|
}
|
|
1505
1505
|
this.autoconsent.updateState({ clicks: this.autoconsent.state.clicks + 1 });
|
|
1506
|
-
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all);
|
|
1506
|
+
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all, retries, retryInterval);
|
|
1507
1507
|
}
|
|
1508
1508
|
wait(ms) {
|
|
1509
1509
|
return this.autoconsent.domActions.wait(ms);
|
|
@@ -1627,7 +1627,7 @@ var AutoConsentCMP = class extends AutoConsentCMPBase {
|
|
|
1627
1627
|
results.push(this.click(rule.click, rule.all));
|
|
1628
1628
|
}
|
|
1629
1629
|
if (rule.waitForThenClick) {
|
|
1630
|
-
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
1630
|
+
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all, rule.retry, rule.retryInterval));
|
|
1631
1631
|
}
|
|
1632
1632
|
if (rule.wait) {
|
|
1633
1633
|
results.push(this.wait(rule.wait));
|
|
@@ -2589,6 +2589,8 @@ var dynamicCMPs = [
|
|
|
2589
2589
|
];
|
|
2590
2590
|
|
|
2591
2591
|
// lib/dom-actions.ts
|
|
2592
|
+
var DEFAULT_CLICK_RETRY_INTERVAL = 300;
|
|
2593
|
+
var CLICK_RETRY_POLL_INTERVAL = 50;
|
|
2592
2594
|
var DomActions = class {
|
|
2593
2595
|
constructor(autoconsentInstance) {
|
|
2594
2596
|
this.autoconsentInstance = autoconsentInstance;
|
|
@@ -2644,9 +2646,19 @@ var DomActions = class {
|
|
|
2644
2646
|
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForVisible]", selector);
|
|
2645
2647
|
return waitFor(() => this.elementVisible(selector, check), times, interval);
|
|
2646
2648
|
}
|
|
2647
|
-
async waitForThenClick(selector, timeout = 1e4, all = false) {
|
|
2649
|
+
async waitForThenClick(selector, timeout = 1e4, all = false, retries = 0, retryInterval = DEFAULT_CLICK_RETRY_INTERVAL) {
|
|
2648
2650
|
await this.waitForElement(selector, timeout);
|
|
2649
|
-
|
|
2651
|
+
let clicked = await this.click(selector, all);
|
|
2652
|
+
for (let attempt = 0; clicked && attempt < retries; attempt++) {
|
|
2653
|
+
const pollTimes = Math.ceil(retryInterval / CLICK_RETRY_POLL_INTERVAL);
|
|
2654
|
+
const isGone = await waitFor(() => !this.elementVisible(selector, "any"), pollTimes, CLICK_RETRY_POLL_INTERVAL);
|
|
2655
|
+
if (isGone) {
|
|
2656
|
+
break;
|
|
2657
|
+
}
|
|
2658
|
+
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForThenClick] retrying click", selector);
|
|
2659
|
+
clicked = await this.click(selector, all);
|
|
2660
|
+
}
|
|
2661
|
+
return clicked;
|
|
2650
2662
|
}
|
|
2651
2663
|
wait(ms) {
|
|
2652
2664
|
this.autoconsentInstance.config.logs.rulesteps && this.autoconsentInstance.config.logs.waits && console.log("[wait]", ms);
|
package/dist/autoconsent.esm.js
CHANGED
|
@@ -1468,12 +1468,12 @@ var AutoConsentCMPBase = class {
|
|
|
1468
1468
|
waitForVisible(selector, timeout, check) {
|
|
1469
1469
|
return this.autoconsent.domActions.waitForVisible(selector, timeout, check);
|
|
1470
1470
|
}
|
|
1471
|
-
async waitForThenClick(selector, timeout, all) {
|
|
1471
|
+
async waitForThenClick(selector, timeout, all, retries, retryInterval) {
|
|
1472
1472
|
if (this.autoconsent.config.visualTest) {
|
|
1473
1473
|
await this.highlightElements(this.elementSelector(selector), all);
|
|
1474
1474
|
}
|
|
1475
1475
|
this.autoconsent.updateState({ clicks: this.autoconsent.state.clicks + 1 });
|
|
1476
|
-
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all);
|
|
1476
|
+
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all, retries, retryInterval);
|
|
1477
1477
|
}
|
|
1478
1478
|
wait(ms) {
|
|
1479
1479
|
return this.autoconsent.domActions.wait(ms);
|
|
@@ -1597,7 +1597,7 @@ var AutoConsentCMP = class extends AutoConsentCMPBase {
|
|
|
1597
1597
|
results.push(this.click(rule.click, rule.all));
|
|
1598
1598
|
}
|
|
1599
1599
|
if (rule.waitForThenClick) {
|
|
1600
|
-
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
1600
|
+
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all, rule.retry, rule.retryInterval));
|
|
1601
1601
|
}
|
|
1602
1602
|
if (rule.wait) {
|
|
1603
1603
|
results.push(this.wait(rule.wait));
|
|
@@ -2559,6 +2559,8 @@ var dynamicCMPs = [
|
|
|
2559
2559
|
];
|
|
2560
2560
|
|
|
2561
2561
|
// lib/dom-actions.ts
|
|
2562
|
+
var DEFAULT_CLICK_RETRY_INTERVAL = 300;
|
|
2563
|
+
var CLICK_RETRY_POLL_INTERVAL = 50;
|
|
2562
2564
|
var DomActions = class {
|
|
2563
2565
|
constructor(autoconsentInstance) {
|
|
2564
2566
|
this.autoconsentInstance = autoconsentInstance;
|
|
@@ -2614,9 +2616,19 @@ var DomActions = class {
|
|
|
2614
2616
|
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForVisible]", selector);
|
|
2615
2617
|
return waitFor(() => this.elementVisible(selector, check), times, interval);
|
|
2616
2618
|
}
|
|
2617
|
-
async waitForThenClick(selector, timeout = 1e4, all = false) {
|
|
2619
|
+
async waitForThenClick(selector, timeout = 1e4, all = false, retries = 0, retryInterval = DEFAULT_CLICK_RETRY_INTERVAL) {
|
|
2618
2620
|
await this.waitForElement(selector, timeout);
|
|
2619
|
-
|
|
2621
|
+
let clicked = await this.click(selector, all);
|
|
2622
|
+
for (let attempt = 0; clicked && attempt < retries; attempt++) {
|
|
2623
|
+
const pollTimes = Math.ceil(retryInterval / CLICK_RETRY_POLL_INTERVAL);
|
|
2624
|
+
const isGone = await waitFor(() => !this.elementVisible(selector, "any"), pollTimes, CLICK_RETRY_POLL_INTERVAL);
|
|
2625
|
+
if (isGone) {
|
|
2626
|
+
break;
|
|
2627
|
+
}
|
|
2628
|
+
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForThenClick] retrying click", selector);
|
|
2629
|
+
clicked = await this.click(selector, all);
|
|
2630
|
+
}
|
|
2631
|
+
return clicked;
|
|
2620
2632
|
}
|
|
2621
2633
|
wait(ms) {
|
|
2622
2634
|
this.autoconsentInstance.config.logs.rulesteps && this.autoconsentInstance.config.logs.waits && console.log("[wait]", ms);
|
|
@@ -1470,12 +1470,12 @@
|
|
|
1470
1470
|
waitForVisible(selector, timeout, check) {
|
|
1471
1471
|
return this.autoconsent.domActions.waitForVisible(selector, timeout, check);
|
|
1472
1472
|
}
|
|
1473
|
-
async waitForThenClick(selector, timeout, all) {
|
|
1473
|
+
async waitForThenClick(selector, timeout, all, retries, retryInterval) {
|
|
1474
1474
|
if (this.autoconsent.config.visualTest) {
|
|
1475
1475
|
await this.highlightElements(this.elementSelector(selector), all);
|
|
1476
1476
|
}
|
|
1477
1477
|
this.autoconsent.updateState({ clicks: this.autoconsent.state.clicks + 1 });
|
|
1478
|
-
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all);
|
|
1478
|
+
return this.autoconsent.domActions.waitForThenClick(selector, timeout, all, retries, retryInterval);
|
|
1479
1479
|
}
|
|
1480
1480
|
wait(ms) {
|
|
1481
1481
|
return this.autoconsent.domActions.wait(ms);
|
|
@@ -1599,7 +1599,7 @@
|
|
|
1599
1599
|
results.push(this.click(rule.click, rule.all));
|
|
1600
1600
|
}
|
|
1601
1601
|
if (rule.waitForThenClick) {
|
|
1602
|
-
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
|
|
1602
|
+
results.push(this.waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all, rule.retry, rule.retryInterval));
|
|
1603
1603
|
}
|
|
1604
1604
|
if (rule.wait) {
|
|
1605
1605
|
results.push(this.wait(rule.wait));
|
|
@@ -2561,6 +2561,8 @@
|
|
|
2561
2561
|
];
|
|
2562
2562
|
|
|
2563
2563
|
// lib/dom-actions.ts
|
|
2564
|
+
var DEFAULT_CLICK_RETRY_INTERVAL = 300;
|
|
2565
|
+
var CLICK_RETRY_POLL_INTERVAL = 50;
|
|
2564
2566
|
var DomActions = class {
|
|
2565
2567
|
constructor(autoconsentInstance) {
|
|
2566
2568
|
this.autoconsentInstance = autoconsentInstance;
|
|
@@ -2616,9 +2618,19 @@
|
|
|
2616
2618
|
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForVisible]", selector);
|
|
2617
2619
|
return waitFor(() => this.elementVisible(selector, check), times, interval);
|
|
2618
2620
|
}
|
|
2619
|
-
async waitForThenClick(selector, timeout = 1e4, all = false) {
|
|
2621
|
+
async waitForThenClick(selector, timeout = 1e4, all = false, retries = 0, retryInterval = DEFAULT_CLICK_RETRY_INTERVAL) {
|
|
2620
2622
|
await this.waitForElement(selector, timeout);
|
|
2621
|
-
|
|
2623
|
+
let clicked = await this.click(selector, all);
|
|
2624
|
+
for (let attempt = 0; clicked && attempt < retries; attempt++) {
|
|
2625
|
+
const pollTimes = Math.ceil(retryInterval / CLICK_RETRY_POLL_INTERVAL);
|
|
2626
|
+
const isGone = await waitFor(() => !this.elementVisible(selector, "any"), pollTimes, CLICK_RETRY_POLL_INTERVAL);
|
|
2627
|
+
if (isGone) {
|
|
2628
|
+
break;
|
|
2629
|
+
}
|
|
2630
|
+
this.autoconsentInstance.config.logs.rulesteps && console.log("[waitForThenClick] retrying click", selector);
|
|
2631
|
+
clicked = await this.click(selector, all);
|
|
2632
|
+
}
|
|
2633
|
+
return clicked;
|
|
2622
2634
|
}
|
|
2623
2635
|
wait(ms) {
|
|
2624
2636
|
this.autoconsentInstance.config.logs.rulesteps && this.autoconsentInstance.config.logs.waits && console.log("[wait]", ms);
|