@duckduckgo/autoconsent 16.15.0 → 16.16.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 +15 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +25 -5
- package/dist/addon-firefox/manifest.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 +25 -5
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +25 -5
- package/dist/autoconsent.esm.js +25 -5
- package/dist/autoconsent.playwright.js +25 -5
- package/dist/autoconsent.standalone.js +26 -6
- package/dist/types/cmps/admiral.d.ts +4 -0
- package/lib/cmps/admiral.ts +41 -5
- package/package.json +1 -1
- package/rules/autoconsent/pandectes.json +5 -3
- package/rules/compact-rules.json +1 -1
- package/rules/rules.json +1 -1
- package/tests/admiral.spec.ts +10 -1
- package/tests/pandectes-mobile.spec.ts +7 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import AutoConsentCMPBase from './base';
|
|
2
2
|
export default class Admiral extends AutoConsentCMPBase {
|
|
3
3
|
name: string;
|
|
4
|
+
private readonly consentCardSelector;
|
|
5
|
+
private getVrmNotice;
|
|
6
|
+
private isVisibleElement;
|
|
7
|
+
private getVrmCloseButton;
|
|
4
8
|
get hasSelfTest(): boolean;
|
|
5
9
|
get isIntermediate(): boolean;
|
|
6
10
|
get isCosmetic(): boolean;
|
package/lib/cmps/admiral.ts
CHANGED
|
@@ -3,6 +3,40 @@ import AutoConsentCMPBase from './base';
|
|
|
3
3
|
export default class Admiral extends AutoConsentCMPBase {
|
|
4
4
|
name = 'Admiral';
|
|
5
5
|
|
|
6
|
+
private readonly consentCardSelector =
|
|
7
|
+
'div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]';
|
|
8
|
+
|
|
9
|
+
private getVrmNotice() {
|
|
10
|
+
return Array.from(document.querySelectorAll<HTMLElement>('body > div')).find((element) => {
|
|
11
|
+
const text = element.innerText || '';
|
|
12
|
+
const rect = element.getBoundingClientRect();
|
|
13
|
+
const style = getComputedStyle(element);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
style.position === 'fixed' &&
|
|
17
|
+
rect.width > 0 &&
|
|
18
|
+
rect.height > 0 &&
|
|
19
|
+
text.includes('Your Privacy') &&
|
|
20
|
+
text.includes('VRM') &&
|
|
21
|
+
text.includes('Admiral')
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private isVisibleElement(element: HTMLElement) {
|
|
27
|
+
const rect = element.getBoundingClientRect();
|
|
28
|
+
const style = getComputedStyle(element);
|
|
29
|
+
|
|
30
|
+
return rect.width > 0 && rect.height > 0 && style.display !== 'none' && style.visibility !== 'hidden';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private getVrmCloseButton() {
|
|
34
|
+
const notice = this.getVrmNotice();
|
|
35
|
+
const closeButton = notice?.querySelector<HTMLElement>('button[aria-label="Close"]');
|
|
36
|
+
|
|
37
|
+
return closeButton && this.isVisibleElement(closeButton) ? closeButton : null;
|
|
38
|
+
}
|
|
39
|
+
|
|
6
40
|
get hasSelfTest(): boolean {
|
|
7
41
|
return false;
|
|
8
42
|
}
|
|
@@ -16,14 +50,11 @@ export default class Admiral extends AutoConsentCMPBase {
|
|
|
16
50
|
}
|
|
17
51
|
|
|
18
52
|
async detectCmp() {
|
|
19
|
-
return this.elementExists(
|
|
53
|
+
return (await this.elementExists(this.consentCardSelector)) || Boolean(this.getVrmNotice());
|
|
20
54
|
}
|
|
21
55
|
|
|
22
56
|
async detectPopup() {
|
|
23
|
-
return this.elementVisible(
|
|
24
|
-
'div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]',
|
|
25
|
-
'any',
|
|
26
|
-
);
|
|
57
|
+
return (await this.elementVisible(this.consentCardSelector, 'any')) || Boolean(this.getVrmNotice());
|
|
27
58
|
}
|
|
28
59
|
|
|
29
60
|
async optOut() {
|
|
@@ -34,6 +65,11 @@ export default class Admiral extends AutoConsentCMPBase {
|
|
|
34
65
|
return await this.click(rejectAllSelector);
|
|
35
66
|
}
|
|
36
67
|
|
|
68
|
+
const vrmCloseButton = this.getVrmCloseButton();
|
|
69
|
+
if (vrmCloseButton) {
|
|
70
|
+
return await this.clickElement(vrmCloseButton);
|
|
71
|
+
}
|
|
72
|
+
|
|
37
73
|
const purposesButtonSelector =
|
|
38
74
|
"xpath///button[contains(., 'Zwecke') or contains(., 'Σκοποί') or contains(., 'Purposes') or contains(., 'Цели') or contains(., 'Eesmärgid') or contains(., 'Tikslai') or contains(., 'Svrhe') or contains(., 'Cele') or contains(., 'Účely') or contains(., 'Finalidades') or contains(., 'Mērķi') or contains(., 'Scopuri') or contains(., 'Fines') or contains(., 'Ändamål') or contains(., 'Finalités') or contains(., 'Doeleinden') or contains(., 'Tarkoitukset') or contains(., 'Scopi') or contains(., 'Amaçlar') or contains(., 'Nameni') or contains(., 'Célok') or contains(., 'Formål')]";
|
|
39
75
|
|
package/package.json
CHANGED
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
"optOut": [
|
|
21
21
|
{
|
|
22
22
|
"if": { "visible": "#pandectes-banner .cc-deny" },
|
|
23
|
-
"then": [{ "
|
|
23
|
+
"then": [{ "waitForThenClick": "#pandectes-banner .cc-deny" }],
|
|
24
24
|
"else": [
|
|
25
|
-
{ "
|
|
26
|
-
{ "
|
|
25
|
+
{ "waitForThenClick": "#pandectes-banner .cc-settings" },
|
|
26
|
+
{ "waitForVisible": ".pd-cp-ui-rejectAll" },
|
|
27
|
+
{ "click": ".pd-cp-ui-rejectAll" },
|
|
28
|
+
{ "waitForVisible": ".pd-cp-ui-save" },
|
|
27
29
|
{ "click": ".pd-cp-ui-save" }
|
|
28
30
|
]
|
|
29
31
|
}
|