@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.
@@ -2566,6 +2566,25 @@ var Admiral = class extends AutoConsentCMPBase {
2566
2566
  constructor() {
2567
2567
  super(...arguments);
2568
2568
  this.name = "Admiral";
2569
+ this.consentCardSelector = "div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]";
2570
+ }
2571
+ getVrmNotice() {
2572
+ return Array.from(document.querySelectorAll("body > div")).find((element) => {
2573
+ const text = element.innerText || "";
2574
+ const rect = element.getBoundingClientRect();
2575
+ const style = getComputedStyle(element);
2576
+ return style.position === "fixed" && rect.width > 0 && rect.height > 0 && text.includes("Your Privacy") && text.includes("VRM") && text.includes("Admiral");
2577
+ });
2578
+ }
2579
+ isVisibleElement(element) {
2580
+ const rect = element.getBoundingClientRect();
2581
+ const style = getComputedStyle(element);
2582
+ return rect.width > 0 && rect.height > 0 && style.display !== "none" && style.visibility !== "hidden";
2583
+ }
2584
+ getVrmCloseButton() {
2585
+ const notice = this.getVrmNotice();
2586
+ const closeButton = notice?.querySelector('button[aria-label="Close"]');
2587
+ return closeButton && this.isVisibleElement(closeButton) ? closeButton : null;
2569
2588
  }
2570
2589
  get hasSelfTest() {
2571
2590
  return false;
@@ -2577,19 +2596,20 @@ var Admiral = class extends AutoConsentCMPBase {
2577
2596
  return false;
2578
2597
  }
2579
2598
  async detectCmp() {
2580
- return this.elementExists("div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]");
2599
+ return await this.elementExists(this.consentCardSelector) || Boolean(this.getVrmNotice());
2581
2600
  }
2582
2601
  async detectPopup() {
2583
- return this.elementVisible(
2584
- "div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]",
2585
- "any"
2586
- );
2602
+ return await this.elementVisible(this.consentCardSelector, "any") || Boolean(this.getVrmNotice());
2587
2603
  }
2588
2604
  async optOut() {
2589
2605
  const rejectAllSelector = "xpath///button[contains(., 'Afvis alle') or contains(., 'Reject all') or contains(., 'Odbaci sve') or contains(., 'Rechazar todo') or contains(., 'Atmesti visus') or contains(., 'Odm\xEDtnout v\u0161e') or contains(., '\u0391\u03C0\u03CC\u03C1\u03C1\u03B9\u03C8\u03B7 \u03CC\u03BB\u03C9\u03BD') or contains(., 'Rejeitar tudo') or contains(., 'T\xFCm\xFCn\xFC reddet') or contains(., '\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u0432\u0441\u0435') or contains(., 'Noraid\u012Bt visu') or contains(., 'Avvisa alla') or contains(., 'Odrzu\u0107 wszystkie') or contains(., 'Alles afwijzen') or contains(., '\u041E\u0442\u0445\u0432\u044A\u0440\u043B\u044F\u043D\u0435 \u043D\u0430 \u0432\u0441\u0438\u0447\u043A\u0438') or contains(., 'Rifiuta tutto') or contains(., 'Zavrni vse') or contains(., 'Az \xF6sszes elutas\xEDt\xE1sa') or contains(., 'Respinge\u021Bi tot') or contains(., 'Alles ablehnen') or contains(., 'Tout rejeter') or contains(., 'Odmietnu\u0165 v\u0161etko') or contains(., 'L\xFCkka k\xF5ik tagasi') or contains(., 'Hylk\xE4\xE4 kaikki')]";
2590
2606
  if (await this.waitForElement(rejectAllSelector, 500)) {
2591
2607
  return await this.click(rejectAllSelector);
2592
2608
  }
2609
+ const vrmCloseButton = this.getVrmCloseButton();
2610
+ if (vrmCloseButton) {
2611
+ return await this.clickElement(vrmCloseButton);
2612
+ }
2593
2613
  const purposesButtonSelector = "xpath///button[contains(., 'Zwecke') or contains(., '\u03A3\u03BA\u03BF\u03C0\u03BF\u03AF') or contains(., 'Purposes') or contains(., '\u0426\u0435\u043B\u0438') or contains(., 'Eesm\xE4rgid') or contains(., 'Tikslai') or contains(., 'Svrhe') or contains(., 'Cele') or contains(., '\xDA\u010Dely') or contains(., 'Finalidades') or contains(., 'M\u0113r\u0137i') or contains(., 'Scopuri') or contains(., 'Fines') or contains(., '\xC4ndam\xE5l') or contains(., 'Finalit\xE9s') or contains(., 'Doeleinden') or contains(., 'Tarkoitukset') or contains(., 'Scopi') or contains(., 'Ama\xE7lar') or contains(., 'Nameni') or contains(., 'C\xE9lok') or contains(., 'Form\xE5l')]";
2594
2614
  const saveAndExitSelector = "xpath///button[contains(., 'Spara & avsluta') or contains(., 'Save & exit') or contains(., 'Ulo\u017Eit a ukon\u010Dit') or contains(., 'Enregistrer et quitter') or contains(., 'Speichern & Verlassen') or contains(., 'Tallenna ja poistu') or contains(., 'I\u0161saugoti ir i\u0161eiti') or contains(., 'Opslaan & afsluiten') or contains(., 'Guardar y salir') or contains(., 'Shrani in zapri') or contains(., 'Ulo\u017Ei\u0165 a ukon\u010Di\u0165') or contains(., 'Kaydet ve \xE7\u0131k\u0131\u015F yap') or contains(., '\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438 \u0432\u044B\u0439\u0442\u0438') or contains(., 'Salvesta ja v\xE4lju') or contains(., 'Salva ed esci') or contains(., 'Gem & afslut') or contains(., '\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03BA\u03B1\u03B9 \u03AD\u03BE\u03BF\u03B4\u03BF\u03C2') or contains(., 'Saglab\u0101t un iziet') or contains(., 'Ment\xE9s \xE9s kil\xE9p\xE9s') or contains(., 'Guardar e sair') or contains(., 'Zapisz & zako\u0144cz') or contains(., 'Salvare \u0219i ie\u0219ire') or contains(., 'Spremi i iza\u0111i') or contains(., '\u0417\u0430\u043F\u0430\u0437\u0432\u0430\u043D\u0435 \u0438 \u0438\u0437\u0445\u043E\u0434')]";
2595
2615
  if (await this.waitForThenClick(purposesButtonSelector) && await this.waitForVisible(saveAndExitSelector)) {
@@ -2536,6 +2536,25 @@ var Admiral = class extends AutoConsentCMPBase {
2536
2536
  constructor() {
2537
2537
  super(...arguments);
2538
2538
  this.name = "Admiral";
2539
+ this.consentCardSelector = "div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]";
2540
+ }
2541
+ getVrmNotice() {
2542
+ return Array.from(document.querySelectorAll("body > div")).find((element) => {
2543
+ const text = element.innerText || "";
2544
+ const rect = element.getBoundingClientRect();
2545
+ const style = getComputedStyle(element);
2546
+ return style.position === "fixed" && rect.width > 0 && rect.height > 0 && text.includes("Your Privacy") && text.includes("VRM") && text.includes("Admiral");
2547
+ });
2548
+ }
2549
+ isVisibleElement(element) {
2550
+ const rect = element.getBoundingClientRect();
2551
+ const style = getComputedStyle(element);
2552
+ return rect.width > 0 && rect.height > 0 && style.display !== "none" && style.visibility !== "hidden";
2553
+ }
2554
+ getVrmCloseButton() {
2555
+ const notice = this.getVrmNotice();
2556
+ const closeButton = notice?.querySelector('button[aria-label="Close"]');
2557
+ return closeButton && this.isVisibleElement(closeButton) ? closeButton : null;
2539
2558
  }
2540
2559
  get hasSelfTest() {
2541
2560
  return false;
@@ -2547,19 +2566,20 @@ var Admiral = class extends AutoConsentCMPBase {
2547
2566
  return false;
2548
2567
  }
2549
2568
  async detectCmp() {
2550
- return this.elementExists("div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]");
2569
+ return await this.elementExists(this.consentCardSelector) || Boolean(this.getVrmNotice());
2551
2570
  }
2552
2571
  async detectPopup() {
2553
- return this.elementVisible(
2554
- "div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]",
2555
- "any"
2556
- );
2572
+ return await this.elementVisible(this.consentCardSelector, "any") || Boolean(this.getVrmNotice());
2557
2573
  }
2558
2574
  async optOut() {
2559
2575
  const rejectAllSelector = "xpath///button[contains(., 'Afvis alle') or contains(., 'Reject all') or contains(., 'Odbaci sve') or contains(., 'Rechazar todo') or contains(., 'Atmesti visus') or contains(., 'Odm\xEDtnout v\u0161e') or contains(., '\u0391\u03C0\u03CC\u03C1\u03C1\u03B9\u03C8\u03B7 \u03CC\u03BB\u03C9\u03BD') or contains(., 'Rejeitar tudo') or contains(., 'T\xFCm\xFCn\xFC reddet') or contains(., '\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u0432\u0441\u0435') or contains(., 'Noraid\u012Bt visu') or contains(., 'Avvisa alla') or contains(., 'Odrzu\u0107 wszystkie') or contains(., 'Alles afwijzen') or contains(., '\u041E\u0442\u0445\u0432\u044A\u0440\u043B\u044F\u043D\u0435 \u043D\u0430 \u0432\u0441\u0438\u0447\u043A\u0438') or contains(., 'Rifiuta tutto') or contains(., 'Zavrni vse') or contains(., 'Az \xF6sszes elutas\xEDt\xE1sa') or contains(., 'Respinge\u021Bi tot') or contains(., 'Alles ablehnen') or contains(., 'Tout rejeter') or contains(., 'Odmietnu\u0165 v\u0161etko') or contains(., 'L\xFCkka k\xF5ik tagasi') or contains(., 'Hylk\xE4\xE4 kaikki')]";
2560
2576
  if (await this.waitForElement(rejectAllSelector, 500)) {
2561
2577
  return await this.click(rejectAllSelector);
2562
2578
  }
2579
+ const vrmCloseButton = this.getVrmCloseButton();
2580
+ if (vrmCloseButton) {
2581
+ return await this.clickElement(vrmCloseButton);
2582
+ }
2563
2583
  const purposesButtonSelector = "xpath///button[contains(., 'Zwecke') or contains(., '\u03A3\u03BA\u03BF\u03C0\u03BF\u03AF') or contains(., 'Purposes') or contains(., '\u0426\u0435\u043B\u0438') or contains(., 'Eesm\xE4rgid') or contains(., 'Tikslai') or contains(., 'Svrhe') or contains(., 'Cele') or contains(., '\xDA\u010Dely') or contains(., 'Finalidades') or contains(., 'M\u0113r\u0137i') or contains(., 'Scopuri') or contains(., 'Fines') or contains(., '\xC4ndam\xE5l') or contains(., 'Finalit\xE9s') or contains(., 'Doeleinden') or contains(., 'Tarkoitukset') or contains(., 'Scopi') or contains(., 'Ama\xE7lar') or contains(., 'Nameni') or contains(., 'C\xE9lok') or contains(., 'Form\xE5l')]";
2564
2584
  const saveAndExitSelector = "xpath///button[contains(., 'Spara & avsluta') or contains(., 'Save & exit') or contains(., 'Ulo\u017Eit a ukon\u010Dit') or contains(., 'Enregistrer et quitter') or contains(., 'Speichern & Verlassen') or contains(., 'Tallenna ja poistu') or contains(., 'I\u0161saugoti ir i\u0161eiti') or contains(., 'Opslaan & afsluiten') or contains(., 'Guardar y salir') or contains(., 'Shrani in zapri') or contains(., 'Ulo\u017Ei\u0165 a ukon\u010Di\u0165') or contains(., 'Kaydet ve \xE7\u0131k\u0131\u015F yap') or contains(., '\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438 \u0432\u044B\u0439\u0442\u0438') or contains(., 'Salvesta ja v\xE4lju') or contains(., 'Salva ed esci') or contains(., 'Gem & afslut') or contains(., '\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03BA\u03B1\u03B9 \u03AD\u03BE\u03BF\u03B4\u03BF\u03C2') or contains(., 'Saglab\u0101t un iziet') or contains(., 'Ment\xE9s \xE9s kil\xE9p\xE9s') or contains(., 'Guardar e sair') or contains(., 'Zapisz & zako\u0144cz') or contains(., 'Salvare \u0219i ie\u0219ire') or contains(., 'Spremi i iza\u0111i') or contains(., '\u0417\u0430\u043F\u0430\u0437\u0432\u0430\u043D\u0435 \u0438 \u0438\u0437\u0445\u043E\u0434')]";
2565
2585
  if (await this.waitForThenClick(purposesButtonSelector) && await this.waitForVisible(saveAndExitSelector)) {
@@ -2538,6 +2538,25 @@
2538
2538
  constructor() {
2539
2539
  super(...arguments);
2540
2540
  this.name = "Admiral";
2541
+ this.consentCardSelector = "div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]";
2542
+ }
2543
+ getVrmNotice() {
2544
+ return Array.from(document.querySelectorAll("body > div")).find((element) => {
2545
+ const text = element.innerText || "";
2546
+ const rect = element.getBoundingClientRect();
2547
+ const style = getComputedStyle(element);
2548
+ return style.position === "fixed" && rect.width > 0 && rect.height > 0 && text.includes("Your Privacy") && text.includes("VRM") && text.includes("Admiral");
2549
+ });
2550
+ }
2551
+ isVisibleElement(element) {
2552
+ const rect = element.getBoundingClientRect();
2553
+ const style = getComputedStyle(element);
2554
+ return rect.width > 0 && rect.height > 0 && style.display !== "none" && style.visibility !== "hidden";
2555
+ }
2556
+ getVrmCloseButton() {
2557
+ const notice = this.getVrmNotice();
2558
+ const closeButton = notice?.querySelector('button[aria-label="Close"]');
2559
+ return closeButton && this.isVisibleElement(closeButton) ? closeButton : null;
2541
2560
  }
2542
2561
  get hasSelfTest() {
2543
2562
  return false;
@@ -2549,19 +2568,20 @@
2549
2568
  return false;
2550
2569
  }
2551
2570
  async detectCmp() {
2552
- return this.elementExists("div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]");
2571
+ return await this.elementExists(this.consentCardSelector) || Boolean(this.getVrmNotice());
2553
2572
  }
2554
2573
  async detectPopup() {
2555
- return this.elementVisible(
2556
- "div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]",
2557
- "any"
2558
- );
2574
+ return await this.elementVisible(this.consentCardSelector, "any") || Boolean(this.getVrmNotice());
2559
2575
  }
2560
2576
  async optOut() {
2561
2577
  const rejectAllSelector = "xpath///button[contains(., 'Afvis alle') or contains(., 'Reject all') or contains(., 'Odbaci sve') or contains(., 'Rechazar todo') or contains(., 'Atmesti visus') or contains(., 'Odm\xEDtnout v\u0161e') or contains(., '\u0391\u03C0\u03CC\u03C1\u03C1\u03B9\u03C8\u03B7 \u03CC\u03BB\u03C9\u03BD') or contains(., 'Rejeitar tudo') or contains(., 'T\xFCm\xFCn\xFC reddet') or contains(., '\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u0432\u0441\u0435') or contains(., 'Noraid\u012Bt visu') or contains(., 'Avvisa alla') or contains(., 'Odrzu\u0107 wszystkie') or contains(., 'Alles afwijzen') or contains(., '\u041E\u0442\u0445\u0432\u044A\u0440\u043B\u044F\u043D\u0435 \u043D\u0430 \u0432\u0441\u0438\u0447\u043A\u0438') or contains(., 'Rifiuta tutto') or contains(., 'Zavrni vse') or contains(., 'Az \xF6sszes elutas\xEDt\xE1sa') or contains(., 'Respinge\u021Bi tot') or contains(., 'Alles ablehnen') or contains(., 'Tout rejeter') or contains(., 'Odmietnu\u0165 v\u0161etko') or contains(., 'L\xFCkka k\xF5ik tagasi') or contains(., 'Hylk\xE4\xE4 kaikki')]";
2562
2578
  if (await this.waitForElement(rejectAllSelector, 500)) {
2563
2579
  return await this.click(rejectAllSelector);
2564
2580
  }
2581
+ const vrmCloseButton = this.getVrmCloseButton();
2582
+ if (vrmCloseButton) {
2583
+ return await this.clickElement(vrmCloseButton);
2584
+ }
2565
2585
  const purposesButtonSelector = "xpath///button[contains(., 'Zwecke') or contains(., '\u03A3\u03BA\u03BF\u03C0\u03BF\u03AF') or contains(., 'Purposes') or contains(., '\u0426\u0435\u043B\u0438') or contains(., 'Eesm\xE4rgid') or contains(., 'Tikslai') or contains(., 'Svrhe') or contains(., 'Cele') or contains(., '\xDA\u010Dely') or contains(., 'Finalidades') or contains(., 'M\u0113r\u0137i') or contains(., 'Scopuri') or contains(., 'Fines') or contains(., '\xC4ndam\xE5l') or contains(., 'Finalit\xE9s') or contains(., 'Doeleinden') or contains(., 'Tarkoitukset') or contains(., 'Scopi') or contains(., 'Ama\xE7lar') or contains(., 'Nameni') or contains(., 'C\xE9lok') or contains(., 'Form\xE5l')]";
2566
2586
  const saveAndExitSelector = "xpath///button[contains(., 'Spara & avsluta') or contains(., 'Save & exit') or contains(., 'Ulo\u017Eit a ukon\u010Dit') or contains(., 'Enregistrer et quitter') or contains(., 'Speichern & Verlassen') or contains(., 'Tallenna ja poistu') or contains(., 'I\u0161saugoti ir i\u0161eiti') or contains(., 'Opslaan & afsluiten') or contains(., 'Guardar y salir') or contains(., 'Shrani in zapri') or contains(., 'Ulo\u017Ei\u0165 a ukon\u010Di\u0165') or contains(., 'Kaydet ve \xE7\u0131k\u0131\u015F yap') or contains(., '\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438 \u0432\u044B\u0439\u0442\u0438') or contains(., 'Salvesta ja v\xE4lju') or contains(., 'Salva ed esci') or contains(., 'Gem & afslut') or contains(., '\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7 \u03BA\u03B1\u03B9 \u03AD\u03BE\u03BF\u03B4\u03BF\u03C2') or contains(., 'Saglab\u0101t un iziet') or contains(., 'Ment\xE9s \xE9s kil\xE9p\xE9s') or contains(., 'Guardar e sair') or contains(., 'Zapisz & zako\u0144cz') or contains(., 'Salvare \u0219i ie\u0219ire') or contains(., 'Spremi i iza\u0111i') or contains(., '\u0417\u0430\u043F\u0430\u0437\u0432\u0430\u043D\u0435 \u0438 \u0438\u0437\u0445\u043E\u0434')]";
2567
2587
  if (await this.waitForThenClick(purposesButtonSelector) && await this.waitForVisible(saveAndExitSelector)) {