@duckduckgo/autoconsent 1.0.7 → 2.1.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.
Files changed (187) hide show
  1. package/.eslintrc.cjs +14 -0
  2. package/.vscode/.idea/.vscode.iml +9 -0
  3. package/.vscode/.idea/modules.xml +8 -0
  4. package/.vscode/.idea/workspace.xml +28 -0
  5. package/.vscode/settings.json +7 -0
  6. package/Jenkinsfile +68 -39
  7. package/api.md +104 -0
  8. package/dist/addon-firefox/background.bundle.js +1 -0
  9. package/dist/addon-firefox/content.bundle.js +1 -0
  10. package/dist/addon-firefox/icons/cog.png +0 -0
  11. package/dist/addon-firefox/icons/cookie-idle.png +0 -0
  12. package/dist/addon-firefox/icons/cookie.png +0 -0
  13. package/dist/addon-firefox/icons/party.png +0 -0
  14. package/dist/addon-firefox/icons/tick.png +0 -0
  15. package/dist/addon-firefox/icons/verified.png +0 -0
  16. package/dist/addon-firefox/rules.json +4167 -0
  17. package/dist/addon-mv3/background.bundle.js +1 -0
  18. package/dist/addon-mv3/content.bundle.js +1 -0
  19. package/dist/addon-mv3/icons/cog.png +0 -0
  20. package/dist/addon-mv3/icons/cookie-idle.png +0 -0
  21. package/dist/addon-mv3/icons/cookie.png +0 -0
  22. package/dist/addon-mv3/icons/party.png +0 -0
  23. package/dist/addon-mv3/icons/tick.png +0 -0
  24. package/dist/addon-mv3/icons/verified.png +0 -0
  25. package/dist/addon-mv3/rules.json +4167 -0
  26. package/dist/autoconsent.cjs.js +1 -1383
  27. package/dist/autoconsent.esm.js +1 -1375
  28. package/dist/autoconsent.playwright.js +1 -0
  29. package/lib/cmps/all.ts +15 -10
  30. package/lib/cmps/base.ts +95 -90
  31. package/lib/cmps/consentmanager.ts +31 -19
  32. package/lib/cmps/consentomatic.ts +89 -0
  33. package/lib/cmps/cookiebot.ts +62 -53
  34. package/lib/cmps/evidon.ts +29 -18
  35. package/lib/cmps/onetrust.ts +32 -20
  36. package/lib/cmps/sourcepoint-frame.ts +104 -0
  37. package/lib/cmps/sourcepoint-top.ts +47 -0
  38. package/lib/cmps/trustarc-frame.ts +115 -0
  39. package/lib/cmps/trustarc-top.ts +97 -0
  40. package/lib/consentomatic/index.ts +233 -70
  41. package/lib/{web/consentomatic → consentomatic}/tools.ts +0 -0
  42. package/lib/eval-handler.ts +58 -0
  43. package/lib/index.ts +0 -2
  44. package/lib/messages.ts +100 -0
  45. package/lib/rule-executors.ts +108 -0
  46. package/lib/rules.ts +82 -0
  47. package/lib/types.ts +35 -0
  48. package/lib/utils.ts +64 -0
  49. package/lib/web.ts +288 -74
  50. package/package.json +20 -16
  51. package/playwright/content.ts +21 -0
  52. package/playwright/runner.ts +162 -0
  53. package/playwright.config.ts +7 -0
  54. package/readme.md +61 -47
  55. package/rollup.config.js +30 -16
  56. package/rules/autoconsent/192.json +17 -0
  57. package/rules/autoconsent/ausopen.json +8 -0
  58. package/rules/autoconsent/baden-wuerttemberg-de.json +7 -3
  59. package/rules/autoconsent/bing.json +14 -0
  60. package/rules/autoconsent/bundesregierung-de.json +5 -1
  61. package/rules/autoconsent/cc-banner.json +0 -1
  62. package/rules/autoconsent/cookie-law-info.json +1 -1
  63. package/rules/autoconsent/cookie-notice.json +1 -2
  64. package/rules/autoconsent/cookieconsent.json +5 -6
  65. package/rules/autoconsent/destatis-de.json +2 -2
  66. package/rules/autoconsent/dunelm.json +18 -0
  67. package/rules/autoconsent/etsy.json +4 -3
  68. package/rules/autoconsent/eu-cookie-compliance.json +0 -1
  69. package/rules/autoconsent/gov-uk.json +10 -0
  70. package/rules/autoconsent/hl-co-uk.json +8 -9
  71. package/rules/autoconsent/johnlewis.json +5 -2
  72. package/rules/autoconsent/marksandspencer.json +8 -0
  73. package/rules/autoconsent/mediamarkt-de.json +1 -1
  74. package/rules/autoconsent/microsoft.json +1 -1
  75. package/rules/autoconsent/notice-cookie.json +0 -1
  76. package/rules/autoconsent/osano.json +4 -2
  77. package/rules/autoconsent/{paypal-de.json → paypal.json} +6 -2
  78. package/rules/autoconsent/snigel.json +2 -1
  79. package/rules/autoconsent/tealium.json +4 -5
  80. package/rules/autoconsent/thefreedictionary.json +1 -1
  81. package/rules/autoconsent/uswitch.json +8 -0
  82. package/rules/autoconsent/waitrose.json +28 -0
  83. package/rules/autoconsent/wetransfer.json +7 -0
  84. package/rules/rules.json +345 -45
  85. package/tests/192.spec.ts +7 -0
  86. package/tests/arzt-auskunft.spec.ts +1 -1
  87. package/tests/asus.spec.ts +1 -1
  88. package/tests/ausopen.spec.ts +7 -0
  89. package/tests/aws.amazon.spec.ts +1 -1
  90. package/tests/baden-wuerttemberg.spec.ts +1 -1
  91. package/tests/borlabs.spec.ts +1 -1
  92. package/tests/bundesregierung.spec.ts +5 -2
  93. package/tests/ccbanner.spec.ts +1 -1
  94. package/tests/consentmanager.spec.ts +3 -3
  95. package/tests/cookiebot.spec.ts +8 -1
  96. package/tests/cookieconsent.spec.ts +1 -1
  97. package/tests/cookielawinfo.spec.ts +1 -1
  98. package/tests/cookienotice.spec.ts +1 -1
  99. package/tests/corona-in-zahlen.spec.ts +1 -1
  100. package/tests/deepl.spec.ts +1 -1
  101. package/tests/destatis.spec.ts +1 -1
  102. package/tests/didomi.spec.ts +7 -3
  103. package/tests/drupal.spec.ts +8 -0
  104. package/tests/dunelm.spec.ts +7 -0
  105. package/tests/etsy.spec.ts +1 -1
  106. package/tests/eu-cookie-compliance-banner.spec.ts +1 -1
  107. package/tests/evidon.spec.ts +7 -2
  108. package/tests/fundingchoices.spec.ts +2 -1
  109. package/tests/gov-uk.spec.ts +9 -0
  110. package/tests/hl-co-uk.spec.ts +1 -1
  111. package/tests/hubspot.spec.ts +1 -1
  112. package/tests/ionos.spec.ts +1 -1
  113. package/tests/johnlewis.spec.ts +2 -2
  114. package/tests/klaro.spec.ts +1 -1
  115. package/tests/marksandspencer.spec.ts +7 -0
  116. package/tests/mediamarkt.spec.ts +1 -1
  117. package/tests/metoffice-gov-uk.spec.ts +1 -1
  118. package/tests/microsoft.spec.ts +1 -1
  119. package/tests/moneysavingexpert.spec.ts +1 -1
  120. package/tests/motor-talk.spec.ts +1 -1
  121. package/tests/national-lottery.spec.ts +1 -1
  122. package/tests/netflix.spec.ts +1 -1
  123. package/tests/nhs.spec.ts +1 -1
  124. package/tests/notice-cookie.spec.ts +1 -1
  125. package/tests/obi.spec.ts +1 -1
  126. package/tests/oil.spec.ts +2 -2
  127. package/tests/onetrust.spec.ts +27 -2
  128. package/tests/osano.spec.ts +1 -1
  129. package/tests/otto.spec.ts +1 -1
  130. package/tests/paypal.spec.ts +8 -6
  131. package/tests/quantcast.spec.ts +5 -2
  132. package/tests/snigel.spec.ts +1 -1
  133. package/tests/sourcepoint.spec.ts +8 -8
  134. package/tests/springer.spec.ts +2 -2
  135. package/tests/steampowered.spec.ts +1 -1
  136. package/tests/tealium.spec.ts +1 -1
  137. package/tests/testcmp.spec.ts +1 -1
  138. package/tests/thalia.spec.ts +1 -1
  139. package/tests/thefreedictionary.spec.ts +1 -1
  140. package/tests/trustarc.spec.ts +26 -3
  141. package/tests/usercentrics-1.spec.ts +1 -1
  142. package/tests/uswitch.spec.ts +7 -0
  143. package/tests/vodafone.spec.ts +1 -1
  144. package/tests/waitrose.spec.ts +7 -0
  145. package/tests/wetransfer.spec.ts +7 -0
  146. package/tests/wordpressgdpr.spec.ts +2 -2
  147. package/tests/xing.spec.ts +1 -1
  148. package/tsconfig.json +2 -2
  149. package/update_version.js +10 -6
  150. package/.eslintrc +0 -12
  151. package/cosmetics/rules.json +0 -110
  152. package/dist/autoconsent.puppet.js +0 -1074
  153. package/lib/cmps/all.js +0 -19
  154. package/lib/cmps/base.js +0 -174
  155. package/lib/cmps/consentmanager.js +0 -31
  156. package/lib/cmps/cookiebot.js +0 -73
  157. package/lib/cmps/evidon.js +0 -26
  158. package/lib/cmps/onetrust.js +0 -34
  159. package/lib/cmps/sourcepoint.js +0 -82
  160. package/lib/cmps/sourcepoint.ts +0 -95
  161. package/lib/cmps/trustarc.js +0 -106
  162. package/lib/cmps/trustarc.ts +0 -147
  163. package/lib/config.js +0 -1
  164. package/lib/consentomatic/index.js +0 -52
  165. package/lib/detector.js +0 -33
  166. package/lib/detector.ts +0 -34
  167. package/lib/hider.js +0 -13
  168. package/lib/hider.ts +0 -16
  169. package/lib/index.js +0 -4
  170. package/lib/messages.d.ts +0 -61
  171. package/lib/node.js +0 -35
  172. package/lib/node.ts +0 -43
  173. package/lib/puppet/tab.js +0 -121
  174. package/lib/puppet/tab.ts +0 -146
  175. package/lib/rules.d.ts +0 -80
  176. package/lib/tabwrapper.js +0 -67
  177. package/lib/tabwrapper.ts +0 -74
  178. package/lib/types.d.ts +0 -61
  179. package/lib/web/consentomatic/index.ts +0 -249
  180. package/lib/web/content-utils.js +0 -29
  181. package/lib/web/content-utils.ts +0 -31
  182. package/lib/web/content.js +0 -89
  183. package/lib/web/content.ts +0 -80
  184. package/lib/web/tab.js +0 -112
  185. package/lib/web/tab.ts +0 -178
  186. package/lib/web.js +0 -95
  187. package/tests/runner.ts +0 -61
@@ -0,0 +1 @@
1
+ !function(){"use strict";class e{constructor(e,t=1e3){this.id=e,this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t})),this.timer=window.setTimeout((()=>{this.reject(new Error("timeout"))}),t)}}const t={pending:new Map,sendContentMessage:null};function o(e="autoconsent-css-rules"){const t=`style#${e}`,o=document.querySelector(t);if(o&&o instanceof HTMLStyleElement)return o;{const t=document.head||document.getElementsByTagName("head")[0]||document.documentElement,o=document.createElement("style");return o.id=e,t.appendChild(o),o}}function n(e,t,o="display"){const n="opacity"===o?"opacity: 0":"display: none",c=`${t.join(",")} { ${n} !important; z-index: -1 !important; pointer-events: none !important; } `;return e instanceof HTMLStyleElement&&(e.innerText+=c,t.length>0)}async function c(e,t,o){const n=await e();return!n&&t>0?new Promise((n=>{setTimeout((async()=>{n(c(e,t-1,o))}),o)})):Promise.resolve(n)}function i(o){return function(o){let n;n=crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString(),t.sendContentMessage({type:"eval",id:n,code:o});const c=new e(n);return t.pending.set(c.id,c),c.promise}(o).catch((e=>!1))}function s(e,t=!1){const o=document.querySelectorAll(e);return o.length>0&&(t?o.forEach((e=>e.click())):o[0].click()),o.length>0}function r(e){return null!==document.querySelector(e)}function a(e,t){const o=document.querySelectorAll(e),n=new Array(o.length);return o.forEach(((e,t)=>{n[t]=function(e){if(!e)return!1;if(null!==e.offsetParent)return!0;{const t=window.getComputedStyle(e);if("fixed"===t.position&&"none"!==t.display)return!0}return!1}(e)})),0!==n.length&&("any"===t?n.some((e=>e)):"none"===t?n.every((e=>!e)):n.every((e=>e)))}function p(e,t=1e4){return c((()=>null!==document.querySelector(e)),Math.ceil(t/200),200)}function l(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}function d(){const e=o("autoconsent-prehide");return e&&e.remove(),!!e}const u={main:!0,frame:!1,url:""};class m{constructor(e){this.runContext=u,this.name=e}get hasSelfTest(){throw new Error("Not Implemented")}get isIntermediate(){throw new Error("Not Implemented")}checkRunContext(){const e={...u,...this.runContext},t=window.top===window;return!(t&&!e.main)&&(!(!t&&!e.frame)&&!(e.url&&!window.location.href.startsWith(e.url)))}detectCmp(){throw new Error("Not Implemented")}async detectPopup(){return!1}optOut(){throw new Error("Not Implemented")}optIn(){throw new Error("Not Implemented")}openCmp(){throw new Error("Not Implemented")}async test(){return Promise.resolve(!0)}}async function h(e){const t=[];if(e.exists&&t.push(r(e.exists)),e.visible&&t.push(a(e.visible,e.check)),e.eval){const o=i(e.eval);t.push(o)}var d,u;if(e.waitFor&&t.push(p(e.waitFor,e.timeout)),e.waitForVisible&&t.push(function(e,t=1e4,o="any"){return c((()=>a(e,o)),Math.ceil(t/200),200)}(e.waitForVisible,e.timeout,e.check)),e.click&&t.push(s(e.click,e.all)),e.waitForThenClick&&t.push(async function(e,t=1e4,o=!1){return await p(e,t),s(e,o)}(e.waitForThenClick,e.timeout,e.all)),e.wait&&t.push(l(e.wait)),e.hide&&t.push((d=e.hide,u=e.method,n(o(),d,u))),0===t.length)return!1;return(await Promise.all(t)).reduce(((e,t)=>e&&t),!0)}class y extends m{constructor(e){super(e.name),this.config=e,this.runContext=e.runContext||u}get hasSelfTest(){return!!this.config.test}get isIntermediate(){return!!this.config.intermediate}get prehideSelectors(){return this.config.prehideSelectors}async _runRulesParallel(e){const t=e.map((e=>h(e)));return(await Promise.all(t)).every((e=>!!e))}async _runRulesSequentially(e){for(const t of e){if(!await h(t)&&!t.optional)return!1}return!0}async detectCmp(){return!!this.config.detectCmp&&this._runRulesParallel(this.config.detectCmp)}async detectPopup(){return!!this.config.detectPopup&&this._runRulesParallel(this.config.detectPopup)}async optOut(){return!!this.config.optOut&&this._runRulesSequentially(this.config.optOut)}async optIn(){return!!this.config.optIn&&this._runRulesSequentially(this.config.optIn)}async openCmp(){return!!this.config.openCmp&&this._runRulesSequentially(this.config.openCmp)}async test(){return this.hasSelfTest?this._runRulesSequentially(this.config.test):super.test()}}const g="#truste-show-consent",k="#truste-consent-track";const b=[new class extends m{constructor(){super("TrustArc-top"),this.prehideSelectors=[".trustarc-banner-container",`.truste_popframe,.truste_overlay,.truste_box_overlay,${k}`],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!1}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}async detectCmp(){const e=r(`#truste-show-consent,${k}`);return e&&(this._shortcutButton=document.querySelector("#truste-consent-required")),e}async detectPopup(){return a(`#truste-consent-content,#trustarc-banner-overlay,${k}`,"all")}openFrame(){s(g)}async optOut(){return this._shortcutButton?(this._shortcutButton.click(),!0):(n(o(),[".truste_popframe",".truste_overlay",".truste_box_overlay",k]),s(g),setTimeout((()=>{o().remove()}),1e4),!0)}async optIn(){return this._optInDone=!0,s("#truste-consent-button")}async openCmp(){return!0}async test(){return!0}},new class extends m{constructor(){super("TrustArc-frame"),this.runContext={main:!1,frame:!0,url:"https://consent-pref.trustarc.com/?"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return!0}async detectPopup(){return a("#defaultpreferencemanager","any")&&a(".mainContent","any")}async navigateToSettings(){return await c((async()=>r(".shp")||a(".advance","any")||r(".switch span:first-child")),10,500),r(".shp")&&s(".shp"),await p(".prefPanel",5e3),a(".advance","any")&&s(".advance"),await c((()=>a(".switch span:first-child","any")),5,1e3)}async optOut(){return await c((()=>"complete"===document.readyState),20,100),await p(".mainContent[aria-hidden=false]",5e3),!!s(".rejectAll")||(r(".prefPanel")&&await p('.prefPanel[style="visibility: visible;"]',3e3),s("#catDetails0")?(s(".submit"),!0):(s(".required")||(await this.navigateToSettings(),s(".switch span:nth-child(1):not(.active)",!0),s(".submit"),p("#gwt-debug-close_id",3e5).then((()=>{s("#gwt-debug-close_id")}))),!0))}async optIn(){return await this.navigateToSettings(),s(".switch span:nth-child(2)",!0),s(".submit"),p("#gwt-debug-close_id",3e5).then((()=>{s("#gwt-debug-close_id")})),!0}},new class extends m{constructor(){super("Cybotcookiebot"),this.prehideSelectors=["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return r("#CybotCookiebotDialogBodyLevelButtonPreferences")}async detectPopup(){return r("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner")}async optOut(){return s(".cookie-alert-extended-detail-link")?(await p(".cookie-alert-configuration",2e3),s(".cookie-alert-configuration-input:checked",!0),s(".cookie-alert-extended-button-secondary"),!0):r("#dtcookie-container")?s(".h-dtcookie-decline"):(s(".cookiebot__button--settings")||s("#CybotCookiebotDialogBodyButtonDecline")||(s(".cookiebanner__link--details"),s('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled',!0),s("#CybotCookiebotDialogBodyButtonDecline"),s("input[id^=CybotCookiebotDialogBodyLevelButton]:checked",!0),r("#CybotCookiebotDialogBodyButtonAcceptSelected")?s("#CybotCookiebotDialogBodyButtonAcceptSelected"):s("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection",!0),await i("window.CookieConsent.hasResponse !== true")&&(await i("window.Cookiebot.dialog.submitConsent()"),await l(500)),r("#cb-confirmedSettings")&&await i("endCookieProcess()")),!0)}async optIn(){return r("#dtcookie-container")?s(".h-dtcookie-accept"):(s(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),s("#CybotCookiebotDialogBodyLevelButtonAccept"),s("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return i("window.CookieConsent.declined === true")}},new class extends m{constructor(){super("Sourcepoint-top"),this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay"],this.runContext={main:!0,frame:!1}}get hasSelfTest(){return!0}get isIntermediate(){return!0}async detectCmp(){return r("div[id^='sp_message_container_']")}async detectPopup(){return a("div[id^='sp_message_container_']","all")}async optIn(){return!0}async optOut(){return!0}async test(){return await i("__tcfapi('getTCData', 2, r => window.__rcsResult = r)"),await i("Object.values(window.__rcsResult.purpose.consents).every(c => !c)")}},new class extends m{constructor(){super("Sourcepoint-frame"),this.ccpaMode=!1,this.runContext={main:!1,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){const e=new URL(location.href);return e.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===e.hostname?(this.ccpaMode=!0,!0):("/index.html"===e.pathname||"/privacy-manager/index.html"===e.pathname)&&e.searchParams.has("message_id")&&e.searchParams.has("requestUUID")}async detectPopup(){return!0}async optIn(){return await p(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!s(".sp_choice_type_11")||!!s(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===new URL(location.href).pathname}async optOut(){if(!this.isManagerOpen()){if(!await p("button.sp_choice_type_12,button.sp_choice_type_13"))return!1;if(!r("button.sp_choice_type_12"))return s("button.sp_choice_type_13");s("button.sp_choice_type_12"),await c((()=>"/privacy-manager/index.html"===location.pathname),200,100)}await p(".type-modal",2e4);try{const e=".sp_choice_type_REJECT_ALL",t=".reject-toggle",o=await Promise.race([p(e,2e3).then((e=>e?0:-1)),p(t,2e3).then((e=>e?1:-1)),p(".pm-features",2e3).then((e=>e?2:-1))]);if(0===o)return await l(1e3),s(e);if(1===o)return s(t);2===o&&(await p(".pm-features",1e4),s(".checked > span",!0),s(".chevron"))}catch(e){}return s(".sp_choice_type_SAVE_AND_EXIT")}},new class extends m{constructor(){super("consentmanager.net"),this.prehideSelectors=["#cmpbox,#cmpbox2"]}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return r("#cmpbox")}async detectPopup(){return a("#cmpbox .cmpmore","any")}async optOut(){return!!s(".cmpboxbtnno")||(r(".cmpwelcomeprpsbtn")?(s(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),s(".cmpboxbtnsave"),!0):(s(".cmpboxbtncustom"),await p(".cmptblbox",2e3),s(".cmptdchoice > a[aria-checked=true]",!0),s(".cmpboxbtnyescustomchoices"),!0))}async optIn(){return s(".cmpboxbtnyes")}},new class extends m{constructor(){super("Evidon")}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return r("#_evidon_banner")}async detectPopup(){return a("#_evidon_banner","any")}async optOut(){return s("#_evidon-decline-button")||(n(o(),["#evidon-prefdiag-overlay","#evidon-prefdiag-background"]),s("#_evidon-option-button"),await p("#evidon-prefdiag-overlay",5e3),s("#evidon-prefdiag-decline")),!0}async optIn(){return s("#_evidon-accept-button")}},new class extends m{constructor(){super("Onetrust"),this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.optanon-alert-box-wrapper,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return r("#onetrust-banner-sdk,.optanon-alert-box-wrapper")}async detectPopup(){return a("#onetrust-banner-sdk,.optanon-alert-box-wrapper","all")}async optOut(){return r("#onetrust-pc-btn-handler")?s("#onetrust-pc-btn-handler"):s(".ot-sdk-show-settings,button.js-cookie-settings"),await p("#onetrust-consent-sdk",2e3),await l(1e3),s("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await p(".save-preference-btn-handler,.js-consent-save",2e3),s(".save-preference-btn-handler,.js-consent-save"),await c((()=>a("#onetrust-banner-sdk","none")),10,500),!0}async optIn(){return s("#onetrust-accept-btn-handler,.js-accept-cookies")}async test(){return await i("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1")}}];class w{static setBase(e){w.base=e}static findElement(e,t=null,o=!1){let n=null;return n=null!=t?Array.from(t.querySelectorAll(e.selector)):null!=w.base?Array.from(w.base.querySelectorAll(e.selector)):Array.from(document.querySelectorAll(e.selector)),null!=e.textFilter&&(n=n.filter((t=>{let o=t.textContent.toLowerCase();if(Array.isArray(e.textFilter)){let t=!1;for(let n of e.textFilter)if(-1!==o.indexOf(n.toLowerCase())){t=!0;break}return t}if(null!=e.textFilter)return-1!==o.indexOf(e.textFilter.toLowerCase())}))),null!=e.styleFilters&&(n=n.filter((t=>{let o=window.getComputedStyle(t),n=!0;for(let t of e.styleFilters){let e=o[t.option];n=t.negated?n&&e!==t.value:n&&e===t.value}return n}))),null!=e.displayFilter&&(n=n.filter((t=>e.displayFilter?0!==t.offsetHeight:0===t.offsetHeight))),null!=e.iframeFilter&&(n=n.filter((t=>e.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location))),null!=e.childFilter&&(n=n.filter((t=>{let o=w.base;w.setBase(t);let n=w.find(e.childFilter);return w.setBase(o),null!=n.target}))),o?n:(n.length>1&&console.warn("Multiple possible targets: ",n,e,t),n[0])}static find(e,t=!1){let o=[];if(null!=e.parent){let n=w.findElement(e.parent,null,t);if(null!=n){if(n instanceof Array)return n.forEach((n=>{let c=w.findElement(e.target,n,t);c instanceof Array?c.forEach((e=>{o.push({parent:n,target:e})})):o.push({parent:n,target:c})})),o;{let c=w.findElement(e.target,n,t);c instanceof Array?c.forEach((e=>{o.push({parent:n,target:e})})):o.push({parent:n,target:c})}}}else{let n=w.findElement(e.target,null,t);n instanceof Array?n.forEach((e=>{o.push({parent:null,target:e})})):o.push({parent:null,target:n})}return 0===o.length&&o.push({parent:null,target:null}),t?o:(1!==o.length&&console.warn("Multiple results found, even though multiple false",o),o[0])}}function _(e){const t=w.find(e);return"css"===e.type?!!t.target:"checkbox"===e.type?!!t.target&&t.target.checked:void 0}async function f(e,t){switch(e.type){case"click":return async function(e){const t=w.find(e);null!=t.target&&t.target.click();return v(0)}(e);case"list":return async function(e,t){for(let o of e.actions)await f(o,t)}(e,t);case"consent":return async function(e,t){for(const o of e.consents){const e=-1!==t.indexOf(o.type);if(o.matcher&&o.toggleAction){_(o.matcher)!==e&&await f(o.toggleAction)}else e?await f(o.trueAction):await f(o.falseAction)}}(e,t);case"ifcss":return async function(e,t){w.find(e).target?e.falseAction&&await f(e.falseAction,t):e.trueAction&&await f(e.trueAction,t)}(e,t);case"waitcss":return async function(e){await new Promise((t=>{let o=e.retries||10;const n=e.waitTime||250,c=()=>{const i=w.find(e);(e.negated&&i.target||!e.negated&&!i.target)&&o>0?(o-=1,setTimeout(c,n)):t()};c()}))}(e);case"foreach":return async function(e,t){const o=w.find(e,!0),n=w.base;for(const n of o)n.target&&(w.setBase(n.target),await f(e.action,t));w.setBase(n)}(e,t);case"hide":return async function(e){const t=w.find(e);t.target&&t.target.classList.add("Autoconsent-Hidden")}(e);case"slide":return async function(e){const t=w.find(e),o=w.find(e.dragTarget);if(t.target){let e=t.target.getBoundingClientRect(),n=o.target.getBoundingClientRect(),c=n.top-e.top,i=n.left-e.left;"y"===this.config.axis.toLowerCase()&&(i=0),"x"===this.config.axis.toLowerCase()&&(c=0);let s=window.screenX+e.left+e.width/2,r=window.screenY+e.top+e.height/2,a=e.left+e.width/2,p=e.top+e.height/2,l=document.createEvent("MouseEvents");l.initMouseEvent("mousedown",!0,!0,window,0,s,r,a,p,!1,!1,!1,!1,0,t.target);let d=document.createEvent("MouseEvents");d.initMouseEvent("mousemove",!0,!0,window,0,s+i,r+c,a+i,p+c,!1,!1,!1,!1,0,t.target);let u=document.createEvent("MouseEvents");u.initMouseEvent("mouseup",!0,!0,window,0,s+i,r+c,a+i,p+c,!1,!1,!1,!1,0,t.target),t.target.dispatchEvent(l),await this.waitTimeout(10),t.target.dispatchEvent(d),await this.waitTimeout(10),t.target.dispatchEvent(u)}}(e);case"close":return async function(e){window.close()}();case"wait":return async function(e){await v(e.waitTime)}(e);case"eval":return async function(e){return console.log("eval!",e.code),new Promise((t=>{try{e.async?(window.eval(e.code),setTimeout((()=>{t(window.eval("window.__consentCheckResult"))}),e.timeout||250)):t(window.eval(e.code))}catch(o){console.warn("eval error",o,e.code),t(!1)}}))}(e);default:throw"Unknown action type: "+e.type}}w.base=null;function v(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}class C{constructor(e,t){this.name=e,this.config=t,this.methods=new Map,this.runContext=u,t.methods.forEach((e=>{e.action&&this.methods.set(e.name,e.action)})),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}async detectCmp(){return this.config.detectors.map((e=>_(e.presentMatcher))).some((e=>!!e))}async detectPopup(){return this.config.detectors.map((e=>_(e.showingMatcher))).some((e=>!!e))}async executeAction(e,t){return!this.methods.has(e)||f(this.methods.get(e),t)}async optOut(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",[]),await this.executeAction("SAVE_CONSENT"),!0}async optIn(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",["D","A","B","E","F","X"]),await this.executeAction("SAVE_CONSENT"),!0}async openCmp(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),!0}async test(){return!0}}class x{constructor(e,o=null,n=null){if(this.rules=[],this.foundCmp=null,t.sendContentMessage=e,this.sendContentMessage=e,this.rules=[...b],o)this.initialize(o,n);else{n&&this.parseRules(n);e({type:"init",url:window.location.href})}}initialize(e,t){if(this.config=e,e.enabled){if(t&&this.parseRules(t),e.disabledCmps?.length>0&&this.disableCMPs(e.disabledCmps),e.enablePrehide)if(document.documentElement)this.prehideElements();else{const e=()=>{window.removeEventListener("DOMContentLoaded",e),this.prehideElements()};window.addEventListener("DOMContentLoaded",e)}if("loading"===document.readyState){const e=()=>{window.removeEventListener("DOMContentLoaded",e),this.start()};window.addEventListener("DOMContentLoaded",e)}else this.start()}}parseRules(e){Object.keys(e.consentomatic).forEach((t=>{this.addConsentomaticCMP(t,e.consentomatic[t])})),e.autoconsent.forEach((e=>{this.addCMP(e)}))}addCMP(e){this.rules.push(function(e){return new y(e)}(e))}disableCMPs(e){this.rules=this.rules.filter((t=>!e.includes(t.name)))}addConsentomaticCMP(e,t){this.rules.push(new C(`com_${e}`,t))}start(){window.requestIdleCallback?window.requestIdleCallback((()=>this._start()),{timeout:500}):this._start()}async _start(){const e=await this.findCmp(this.config.detectRetries);if(e){this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:e.name});return await this.waitForPopup(e)?(this.foundCmp=e,this.sendContentMessage({type:"popupFound",cmp:e.name,url:location.href}),"optOut"===this.config.autoAction?await this.doOptOut():"optIn"!==this.config.autoAction||await this.doOptIn()):(this.config.enablePrehide&&d(),!1)}return this.config.enablePrehide&&d(),!1}async findCmp(e){let t=null;const o=[];for(const e of this.rules)try{if(!e.checkRunContext())continue;await e.detectCmp()&&(o.push(e),t||(t=e))}catch(e){}if(o.length>1){const e={msg:"Found multiple CMPs, check the detection rules.",cmps:o.map((e=>e.name))};this.sendContentMessage({type:"autoconsentError",details:e})}return!t&&e>0?new Promise((t=>{setTimeout((async()=>{const o=this.findCmp(e-1);t(o)}),500)})):t}async doOptOut(){let e;return e=!!this.foundCmp&&await this.foundCmp.optOut(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:this.foundCmp&&this.foundCmp.hasSelfTest,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doOptIn(){let e;return e=!!this.foundCmp&&await this.foundCmp.optIn(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:!1,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doSelfTest(){let e;return e=!!this.foundCmp&&await this.foundCmp.test(),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,url:location.href}),e}async waitForPopup(e,t=5,o=500){const n=await e.detectPopup();return!n&&t>0?new Promise((n=>setTimeout((()=>n(this.waitForPopup(e,t-1,o))),o))):n}prehideElements(){return function(e){return n(o("autoconsent-prehide"),e,"opacity")}(this.rules.reduce(((e,t)=>t.prehideSelectors?[...e,...t.prehideSelectors]:e),["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]))}async receiveMessageCallback(e){switch(e.type){case"initResp":this.initialize(e.config,e.rules);break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(e,o){const n=t.pending.get(e);n?(t.pending.delete(e),n.timer&&window.clearTimeout(n.timer),n.resolve(o)):console.warn("no eval #",e)}(e.id,e.result)}}}var A=[{name:"192.com",detectCmp:[{exists:".ont-cookies"}],detectPopup:[{visible:".ont-cookies"}],optIn:[{click:".ont-btn-main.ont-cookies-btn.js-ont-btn-ok2"}],optOut:[{click:".ont-cookes-btn-manage"},{click:".ont-btn-main.ont-cookies-btn.js-ont-btn-choose"}],test:[{eval:"document.cookie.includes('CC_ADVERTISING=NO') && document.cookie.includes('CC_ANALYTICS=NO')"}]},{name:"arzt-auskunft.de",prehideSelectors:["#cookiescript_injected"],detectCmp:[{exists:"#cookiescript_injected"}],detectPopup:[{visible:"#cookiescript_injected"}],optOut:[{click:"#cookiescript_reject"}],optIn:[{click:"#cookiescript_accept"}]},{name:"asus",detectCmp:[{exists:"#cookie-policy-info"}],detectPopup:[{visible:"#cookie-policy-info"}],optIn:[{click:".btn-read-ck"}],optOut:[{click:".btn-setting"},{click:".btn-save"}]},{name:"ausopen.com",isHidingRule:!0,detectCmp:[{exists:".gdpr-popup__message"}],detectPopup:[{visible:".gdpr-popup__message"}],optOut:[{hide:[".gdpr-popup__message"]}],optIn:[{click:[".gdpr-popup__message button"]}]},{name:"aws.amazon.com",prehideSelectors:["#awsccc-cb-content","#awsccc-cs-container","#awsccc-cs-modalOverlay","#awsccc-cs-container-inner"],detectCmp:[{exists:"#awsccc-cb-content"}],detectPopup:[{visible:"#awsccc-cb-content"}],optIn:[{click:"button[data-id=awsccc-cb-btn-accept"}],optOut:[{click:"button[data-id=awsccc-cb-btn-customize]"},{eval:"Array.from(document.querySelectorAll('input[aria-checked=true')).forEach(e => e.click()) || true"},{click:"button[data-id=awsccc-cs-btn-save]"}]},{name:"baden-wuerttemberg.de",prehideSelectors:[".cookie-alert.t-dark"],detectCmp:[{exists:".cookie-alert.t-dark"}],detectPopup:[{visible:".cookie-alert.t-dark"}],optIn:[{click:".cookie-alert__form input:not([disabled]):not([checked])"},{click:".cookie-alert__button button"}],optOut:[{hide:[".cookie-alert.t-dark"]}]},{name:"bing.com",prehideSelectors:["#bnp_container"],detectCmp:[{exists:"#bnp_cookie_banner"}],detectPopup:[{visible:"#bnp_cookie_banner"}],optIn:[{click:"#bnp_btn_accept"}],optOut:[{click:"#bnp_btn_preference"},{click:"#mcp_savesettings"}],test:[{eval:"document.cookie.includes('AL=0') && document.cookie.includes('AD=0') && document.cookie.includes('SM=0')"}]},{name:"borlabs",prehideSelectors:["#BorlabsCookieBox"],detectCmp:[{exists:"._brlbs-block-content"}],detectPopup:[{visible:"._brlbs-bar-wrap,._brlbs-box-wrap"}],optIn:[{click:"a[data-cookie-accept-all]"}],optOut:[{click:"a[data-cookie-refuse]"}]},{name:"bundesregierung.de",prehideSelectors:[".bpa-cookie-banner"],detectCmp:[{exists:".bpa-cookie-banner"}],detectPopup:[{visible:".bpa-cookie-banner .bpa-module-full-hero"}],optIn:[{click:".bpa-accept-all-button"}],optOut:[{wait:500,comment:"click is not immediately recognized"},{waitForThenClick:".bpa-close-button"}],test:[{eval:"document.cookie.match('cookie-allow-tracking=0')"}]},{name:"cc_banner",prehideSelectors:[".cc_banner-wrapper"],detectCmp:[{exists:".cc_banner-wrapper"}],detectPopup:[{visible:".cc_banner"}],optIn:[{click:".cc_btn_accept_all"}],optOut:[{hide:[".cc_banner-wrapper"]}]},{name:"cookie-law-info",prehideSelectors:["#cookie-law-info-bar"],detectCmp:[{exists:"#cookie-law-info-bar"}],detectPopup:[{visible:"#cookie-law-info-bar"}],optIn:[{click:'[data-cli_action="accept_all"]'}],optOut:[{hide:["#cookie-law-info-bar"]},{eval:"CLI.disableAllCookies() || CLI.reject_close() || true"}],test:[{eval:"document.cookie.indexOf('cookielawinfo-checkbox-non-necessary=yes') === -1"}]},{name:"cookie-notice",prehideSelectors:["#cookie-notice"],detectCmp:[{exists:"#cookie-notice"}],detectPopup:[{visible:"#cookie-notice"}],optIn:[{click:["#cn-accept-cookie"]}],optOut:[{hide:["#cookie-notice"]}]},{name:"cookieconsent",prehideSelectors:['[aria-label="cookieconsent"][aria-describedby="cookieconsent:desc"]'],detectCmp:[{exists:'[aria-label="cookieconsent"][aria-describedby="cookieconsent:desc"]'}],detectPopup:[{visible:'[aria-label="cookieconsent"][aria-describedby="cookieconsent:desc"]'}],optIn:[{click:".cc-dismiss"}],optOut:[{hide:['[aria-label="cookieconsent"][aria-describedby="cookieconsent:desc"]']}]},{name:"corona-in-zahlen.de",prehideSelectors:[".cookiealert"],detectCmp:[{exists:".cookiealert"}],detectPopup:[{visible:".cookiealert"}],optOut:[{click:".configurecookies"},{click:".confirmcookies"}],optIn:[{click:".acceptcookies"}]},{name:"deepl.com",prehideSelectors:[".dl_cookieBanner_container"],detectCmp:[{exists:".dl_cookieBanner_container"}],detectPopup:[{visible:".dl_cookieBanner_container"}],optOut:[{click:".dl_cookieBanner--buttonSelected"}],optIn:[{click:".dl_cookieBanner--buttonAll"}]},{name:"destatis.de",prehideSelectors:["div[aria-labelledby=cookiebannerhead]"],detectCmp:[{exists:".cookiebannerbox"}],detectPopup:[{visible:".cookiebannerbox"}],optOut:[{hide:[".cookiebannerbox"]}],optIn:[{click:[".cookiebannerbox .close"]}]},{name:"Drupal",detectCmp:[{exists:"#drupalorg-crosssite-gdpr"}],detectPopup:[{visible:"#drupalorg-crosssite-gdpr"}],optOut:[{click:".no"}],optIn:[{click:".yes"}]},{name:"dunelm.com",prehideSelectors:["div[data-testid=cookie-consent-modal-backdrop]"],detectCmp:[{exists:"div[data-testid=cookie-consent-message-contents]"}],detectPopup:[{visible:"div[data-testid=cookie-consent-message-contents]"}],optIn:[{click:'[data-testid="cookie-consent-allow-all"]'}],optOut:[{click:"button[data-testid=cookie-consent-adjust-settings]"},{click:"button[data-testid=cookie-consent-preferences-save]"}],test:[{eval:"document.cookie.includes('cc_functional=0') && document.cookie.includes('cc_targeting=0')"}]},{name:"etsy",prehideSelectors:["#gdpr-single-choice-overlay","#gdpr-privacy-settings"],detectCmp:[{exists:"#gdpr-single-choice-overlay"}],detectPopup:[{visible:"#gdpr-single-choice-overlay"}],optOut:[{click:"button[data-gdpr-open-full-settings]"},{waitForVisible:".gdpr-overlay-body input",timeout:3e3},{wait:1e3},{eval:'document.querySelectorAll(".gdpr-overlay-body input").forEach(toggle => { toggle.checked = false; }) || true'},{eval:"document.querySelector('.gdpr-overlay-view button[data-wt-overlay-close]').click() || true"}],optIn:[{click:"button[data-gdpr-single-choice-accept]"}]},{name:"eu-cookie-compliance-banner",detectCmp:[{exists:".eu-cookie-compliance-banner-info"}],detectPopup:[{visible:".eu-cookie-compliance-banner-info"}],optIn:[{click:".agree-button"}],optOut:[{click:".decline-button,.eu-cookie-compliance-save-preferences-button",optional:!0},{hide:[".eu-cookie-compliance-banner-info","#sliding-popup"]}],test:[{eval:"document.cookie.indexOf('cookie-agreed=2') === -1"}]},{name:"funding-choices",prehideSelectors:[".fc-consent-root,.fc-dialog-container,.fc-dialog-overlay,.fc-dialog-content"],detectCmp:[{exists:".fc-consent-root"}],detectPopup:[{exists:".fc-dialog-container"}],optOut:[{click:".fc-cta-do-not-consent,.fc-cta-manage-options"},{click:".fc-preference-consent:checked,.fc-preference-legitimate-interest:checked",all:!0,optional:!0},{click:".fc-confirm-choices",optional:!0}],optIn:[{click:".fc-cta-consent"}]},{name:"gov.uk",detectCmp:[{exists:"#global-cookie-message"}],detectPopup:[{exists:"#global-cookie-message"}],optIn:[{click:"button[data-accept-cookies=true]"}],optOut:[{click:"button[data-reject-cookies=true],#reject-cookies"},{click:"button[data-hide-cookie-banner=true],#hide-cookie-decision"}]},{name:"hl.co.uk",prehideSelectors:[".cookieModalContent","#cookie-banner-overlay"],detectCmp:[{exists:"#cookie-banner-overlay"}],detectPopup:[{exists:"#cookie-banner-overlay"}],optIn:[{click:"#acceptCookieButton"}],optOut:[{click:"#manageCookie"},{hide:[".cookieSettingsModal"]},{waitFor:"#AOCookieToggle"},{click:"#AOCookieToggle[aria-pressed=true]",optional:!0},{waitFor:"#TPCookieToggle"},{click:"#TPCookieToggle[aria-pressed=true]",optional:!0},{click:"#updateCookieButton"}]},{name:"hubspot",detectCmp:[{exists:"#hs-eu-cookie-confirmation"}],detectPopup:[{visible:"#hs-eu-cookie-confirmation"}],optIn:[{click:"#hs-eu-confirmation-button"}],optOut:[{click:"#hs-eu-decline-button"}]},{name:"ionos.de",prehideSelectors:[".privacy-consent--backdrop",".privacy-consent--modal"],detectCmp:[{exists:".privacy-consent--modal"}],detectPopup:[{visible:".privacy-consent--modal"}],optIn:[{click:"#selectAll"}],optOut:[{click:".footer-config-link"},{click:"#confirmSelection"}]},{name:"johnlewis.com",prehideSelectors:["div[class^=pecr-cookie-banner-]"],detectCmp:[{exists:"div[class^=pecr-cookie-banner-]"}],detectPopup:[{exists:"div[class^=pecr-cookie-banner-]"}],optOut:[{click:"button[data-test^=manage-cookies]"},{wait:"500"},{click:"label[data-test^=toggle][class*=checked]:not([class*=disabled])",all:!0,optional:!0},{click:"button[data-test=save-preferences]"}],optIn:[{click:"button[data-test=allow-all]"}]},{name:"klaro",detectCmp:[{exists:".klaro > .cookie-notice"}],detectPopup:[{visible:".klaro > .cookie-notice"}],optIn:[{click:".cm-btn-success"}],optOut:[{click:".cn-decline"}],test:[{eval:"Object.values(klaro.getManager().consents).every(c => !c)"}]},{name:"marksandspencer.com",isHidingRule:!0,detectCmp:[{exists:".navigation-cookiebbanner"}],detectPopup:[{visible:".navigation-cookiebbanner"}],optOut:[{hide:[".navigation-cookiebbanner"]}],optIn:[{click:[".navigation-cookiebbanner__submit"]}]},{name:"mediamarkt.de",prehideSelectors:["div[aria-labelledby=pwa-consent-layer-title]","div[class^=StyledConsentLayerWrapper-]"],detectCmp:[{exists:"div[aria-labelledby^=pwa-consent-layer-title]"}],detectPopup:[{exists:"div[aria-labelledby^=pwa-consent-layer-title]"}],optOut:[{click:"button[data-test^=pwa-consent-layer-deny-all]"}],optIn:[{click:"button[data-test^=pwa-consent-layer-accept-all"}]},{name:"metoffice.gov.uk",prehideSelectors:["#ccc-module"],detectCmp:[{exists:"#ccc-module"}],detectPopup:[{exists:"#ccc-module"}],optOut:[{click:"#ccc-reject-settings"}],optIn:[{click:"#ccc-recommended-settings"}]},{name:"microsoft.com",prehideSelectors:["#wcpConsentBannerCtrl"],detectCmp:[{exists:"#wcpConsentBannerCtrl"}],detectPopup:[{exists:"#wcpConsentBannerCtrl"}],optOut:[{eval:"Array.from(document.querySelectorAll('div > button')).filter(el => el.innerText.match('Reject|Ablehnen'))[0].click() || true"}],optIn:[{eval:"Array.from(document.querySelectorAll('div > button')).filter(el => el.innerText.match('Accept|Annehmen'))[0].click() || true"}],test:[{eval:"!!document.cookie.match('MSCC')"}]},{name:"moneysavingexpert.com",detectCmp:[{exists:"dialog[data-testid=accept-our-cookies-dialog]"}],detectPopup:[{visible:"dialog[data-testid=accept-our-cookies-dialog]"}],optIn:[{click:"#banner-accept"}],optOut:[{click:"#banner-manage"},{click:"#pc-confirm"}]},{name:"motor-talk.de",prehideSelectors:[".mt-cc-bnnr__wrapper"],detectCmp:[{exists:".mt-cc-bnnr"}],detectPopup:[{visible:".mt-cc-bnnr__wrapper"}],optIn:[{click:".mt-cc-bnnr__button-main"}],optOut:[{click:".mt-cc-bnnr__decline-link"}]},{name:"national-lottery.co.uk",detectCmp:[{exists:".cuk_cookie_consent"}],detectPopup:[{visible:".cuk_cookie_consent",check:"any"}],optOut:[{click:".cuk_cookie_consent_manage_pref"},{click:".cuk_cookie_consent_save_pref"},{click:".cuk_cookie_consent_close"}],optIn:[{click:".cuk_cookie_consent_accept_all"}]},{name:"netflix.de",detectCmp:[{exists:"#cookie-disclosure"}],detectPopup:[{visible:".cookie-disclosure-message",check:"any"}],optIn:[{click:".btn-accept"}],optOut:[{hide:["#cookie-disclosure"]},{click:".btn-reject"}]},{name:"nhs.uk",prehideSelectors:["#nhsuk-cookie-banner"],detectCmp:[{exists:"#nhsuk-cookie-banner"}],detectPopup:[{exists:"#nhsuk-cookie-banner"}],optOut:[{click:"#nhsuk-cookie-banner__link_accept"}],optIn:[{click:"#nhsuk-cookie-banner__link_accept_analytics"}]},{name:"notice-cookie",prehideSelectors:[".button--notice"],detectCmp:[{exists:".notice--cookie"}],detectPopup:[{visible:".notice--cookie"}],optIn:[{click:".button--notice"}],optOut:[{hide:[".notice--cookie"]}]},{name:"obi.de",prehideSelectors:[".disc-cp--active"],detectCmp:[{exists:".disc-cp-modal__modal"}],detectPopup:[{visible:".disc-cp-modal__modal"}],optIn:[{click:".js-disc-cp-accept-all"}],optOut:[{click:".js-disc-cp-deny-all"}]},{name:"osano",prehideSelectors:[".osano-cm-window"],detectCmp:[{exists:".osano-cm-window"}],detectPopup:[{visible:".osano-cm-dialog"}],optIn:[{click:".osano-cm-accept-all",optional:!0}],optOut:[{hide:[".osano-cm-window"]}]},{name:"otto.de",prehideSelectors:[".cookieBanner--visibility"],detectCmp:[{exists:".cookieBanner--visibility"}],detectPopup:[{visible:".cookieBanner__wrapper"}],optIn:[{click:".js_cookieBannerPermissionButton"}],optOut:[{click:".js_cookieBannerProhibitionButton"}]},{name:"paypal.com",prehideSelectors:["#gdprCookieBanner"],detectCmp:[{exists:"#gdprCookieBanner"}],detectPopup:[{visible:"#gdprCookieContent_wrapper"}],optIn:[{click:"#acceptAllButton"}],optOut:[{wait:200},{click:".gdprCookieBanner_decline-button"}],test:[{eval:"document.cookie.includes('cookie_prefs') === true"}]},{name:"quantcast",prehideSelectors:["#qc-cmp2-main,#qc-cmp2-container"],detectCmp:[{exists:"#qc-cmp2-container"}],detectPopup:[{visible:"#qc-cmp2-ui"}],optOut:[{click:'.qc-cmp2-summary-buttons > button[mode="secondary"]'},{waitFor:"#qc-cmp2-ui"},{click:'.qc-cmp2-toggle-switch > button[aria-checked="true"]',all:!0,optional:!0},{click:'.qc-cmp2-main button[aria-label="REJECT ALL"]',optional:!0},{waitForThenClick:'.qc-cmp2-main button[aria-label="SAVE & EXIT"],.qc-cmp2-buttons-desktop > button[mode="primary"]',timeout:5e3}],optIn:[{click:'.qc-cmp2-summary-buttons > button[mode="primary"]'}]},{name:"snigel",detectCmp:[{exists:".snigel-cmp-framework"}],detectPopup:[{visible:".snigel-cmp-framework"}],optOut:[{click:"#sn-b-custom"},{click:"#sn-b-save"}],test:[{eval:"!!document.cookie.match('snconsent')"}],optIn:[{click:".snigel-cmp-framework #accept-choices"}]},{name:"steampowered.com",detectCmp:[{exists:".cookiepreferences_popup"},{visible:".cookiepreferences_popup"}],detectPopup:[{visible:".cookiepreferences_popup"}],optOut:[{click:"#rejectAllButton"}],optIn:[{click:"#acceptAllButton"}],test:[{wait:1e3},{eval:"JSON.parse(decodeURIComponent(document.cookie.split(';').find(s => s.trim().startsWith('cookieSettings')).split('=')[1])).preference_state === 2"}]},{name:"Tealium",prehideSelectors:["#__tealiumGDPRecModal,#__tealiumGDPRcpPrefs,#consent-layer"],detectCmp:[{visible:"#__tealiumGDPRecModal"},{eval:"typeof window.utag !== 'undefined' && typeof utag.gdpr === 'object'"}],detectPopup:[{visible:"#__tealiumGDPRecModal"}],optOut:[{hide:["#__tealiumGDPRecModal","#__tealiumGDPRcpPrefs","#consent-layer"]},{waitForThenClick:"#cm-acceptNone,.js-accept-essential-cookies",timeout:1e3},{eval:"utag.gdpr.setConsentValue(false) || true"}],optIn:[{hide:["#__tealiumGDPRecModal"]},{eval:"utag.gdpr.setConsentValue(true) || true"}],test:[{eval:"utag.gdpr.getConsentState() !== 1"}]},{name:"Test page CMP",prehideSelectors:["#reject-all"],detectCmp:[{exists:"#privacy-test-page-cmp-test"}],detectPopup:[{visible:"#privacy-test-page-cmp-test"}],optIn:[{click:"#accept-all"}],optOut:[{waitFor:"#reject-all"},{click:"#reject-all"}],test:[{eval:"window.results.results[0] === 'button_clicked'"}]},{name:"thalia.de",prehideSelectors:[".consent-banner-box"],detectCmp:[{exists:"consent-banner[component=consent-banner]"}],detectPopup:[{visible:".consent-banner-box"}],optIn:[{click:".button-zustimmen"}],optOut:[{click:"button[data-consent=disagree]"}]},{name:"thefreedictionary.com",prehideSelectors:["#cmpBanner"],detectCmp:[{exists:"#cmpBanner"}],detectPopup:[{visible:"#cmpBanner"}],optIn:[{eval:"cmpUi.allowAll() || true"}],optOut:[{eval:"cmpUi.showPurposes() || cmpUi.rejectAll() || true"}]},{name:"usercentrics-1",detectCmp:[{exists:"#usercentrics-root"}],detectPopup:[{eval:"!!document.querySelector('#usercentrics-root').shadowRoot.querySelector('#uc-center-container')"}],optIn:[{eval:"!!UC_UI.acceptAllConsents()"},{eval:"!!UC_UI.closeCMP()"},{eval:"UC_UI.areAllConsentsAccepted() === true"}],optOut:[{eval:"!!UC_UI.closeCMP()"},{eval:"!!UC_UI.denyAllConsents()"}],test:[{eval:"UC_UI.areAllConsentsAccepted() === false"}]},{name:"uswitch.com",prehideSelectors:["#cookie-banner-wrapper"],detectCmp:[{exists:"#cookie-banner-wrapper"}],detectPopup:[{visible:"#cookie-banner-wrapper"}],optIn:[{click:"#cookie_banner_accept_mobile"}],optOut:[{click:"#cookie_banner_save"}]},{name:"vodafone.de",prehideSelectors:[".dip-consent,.dip-consent-container"],detectCmp:[{exists:".dip-consent-container"}],detectPopup:[{visible:".dip-consent-content"}],optOut:[{click:".dip-consent-btn.white-btn"},{eval:"Array.from(document.querySelectorAll('.dip-consent-btn.red-btn')).filter(e => e.innerText === 'Auswahl bestätigen')[0].click() || true"}],optIn:[{click:".dip-consent-btn.red-btn"}]},{name:"waitrose.com",prehideSelectors:["div[aria-labelledby=CookieAlertModalHeading]","section[data-test=initial-waitrose-cookie-consent-banner]","section[data-test=cookie-consent-modal]"],detectCmp:[{exists:"section[data-test=initial-waitrose-cookie-consent-banner]"}],detectPopup:[{visible:"section[data-test=initial-waitrose-cookie-consent-banner]"}],optIn:[{click:"button[data-test=accept-all]"}],optOut:[{click:"button[data-test=manage-cookies]"},{wait:200},{eval:"Array.from(document.querySelectorAll('label[id$=cookies-deny-label]')).forEach(e => e.click()) || true"},{click:"button[data-test=submit]"}],test:[{eval:"document.cookie.includes('wtr_cookies_advertising=0') && document.cookie.includes('wtr_cookies_analytics=0')"}]},{name:"wetransfer.com",detectCmp:[{exists:".welcome__cookie-notice"}],detectPopup:[{visible:".welcome__cookie-notice"}],optIn:[{click:".welcome__button--accept"}],optOut:[{click:".welcome__button--decline"}]},{name:"xing.com",detectCmp:[{exists:"div[class^=cookie-consent-CookieConsent]"}],detectPopup:[{exists:"div[class^=cookie-consent-CookieConsent]"}],optIn:[{click:"#consent-accept-button"}],optOut:[{click:"#consent-settings-button"},{click:".consent-banner-button-accept-overlay"}],test:[{eval:"document.cookie.includes('userConsent=%7B%22marketing%22%3Afalse')"}]}],S={"didomi.io":{detectors:[{presentMatcher:{target:{selector:"#didomi-host, #didomi-notice"},type:"css"},showingMatcher:{target:{selector:"body.didomi-popup-open, .didomi-notice-banner"},type:"css"}}],methods:[{action:{target:{selector:".didomi-popup-notice-buttons .didomi-button:not(.didomi-button-highlight), .didomi-notice-banner .didomi-learn-more-button"},type:"click"},name:"OPEN_OPTIONS"},{action:{actions:[{retries:50,target:{selector:"#didomi-purpose-cookies"},type:"waitcss",waitTime:50},{consents:[{description:"Share (everything) with others",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-share_whith_others]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-share_whith_others]:last-child"},type:"click"},type:"X"},{description:"Information storage and access",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-cookies]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-cookies]:last-child"},type:"click"},type:"D"},{description:"Content selection, offers and marketing",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-CL-T1Rgm7]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-CL-T1Rgm7]:last-child"},type:"click"},type:"E"},{description:"Analytics",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-analytics]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-analytics]:last-child"},type:"click"},type:"B"},{description:"Analytics",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-M9NRHJe3G]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-M9NRHJe3G]:last-child"},type:"click"},type:"B"},{description:"Ad and content selection",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-advertising_personalization]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-advertising_personalization]:last-child"},type:"click"},type:"F"},{description:"Ad and content selection",falseAction:{parent:{childFilter:{target:{selector:"#didomi-purpose-pub-ciblee"}},selector:".didomi-consent-popup-data-processing, .didomi-components-accordion-label-container"},target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-pub-ciblee]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-pub-ciblee]:last-child"},type:"click"},type:"F"},{description:"Ad and content selection - basics",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-q4zlJqdcD]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-q4zlJqdcD]:last-child"},type:"click"},type:"F"},{description:"Ad and content selection - partners and subsidiaries",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-partenaire-cAsDe8jC]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-partenaire-cAsDe8jC]:last-child"},type:"click"},type:"F"},{description:"Ad and content selection - social networks",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-p4em9a8m]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-p4em9a8m]:last-child"},type:"click"},type:"F"},{description:"Ad and content selection - others",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-autres-pub]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-autres-pub]:last-child"},type:"click"},type:"F"},{description:"Social networks",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-reseauxsociaux]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-reseauxsociaux]:last-child"},type:"click"},type:"A"},{description:"Social networks",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-social_media]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-social_media]:last-child"},type:"click"},type:"A"},{description:"Content selection",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-content_personalization]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-content_personalization]:last-child"},type:"click"},type:"E"},{description:"Ad delivery",falseAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-ad_delivery]:first-child"},type:"click"},trueAction:{target:{selector:".didomi-components-radio__option[aria-describedby=didomi-purpose-ad_delivery]:last-child"},type:"click"},type:"F"}],type:"consent"},{action:{consents:[{matcher:{childFilter:{target:{selector:":not(.didomi-components-radio__option--selected)"}},type:"css"},trueAction:{target:{selector:":nth-child(2)"},type:"click"},falseAction:{target:{selector:":first-child"},type:"click"},type:"X"}],type:"consent"},target:{selector:".didomi-components-radio"},type:"foreach"}],type:"list"},name:"DO_CONSENT"},{action:{parent:{selector:".didomi-consent-popup-footer .didomi-consent-popup-actions"},target:{selector:".didomi-components-button:first-child"},type:"click"},name:"SAVE_CONSENT"}]},oil:{detectors:[{presentMatcher:{target:{selector:".as-oil-content-overlay"},type:"css"},showingMatcher:{target:{selector:".as-oil-content-overlay"},type:"css"}}],methods:[{action:{actions:[{target:{selector:".as-js-advanced-settings"},type:"click"},{retries:"10",target:{selector:".as-oil-cpc__purpose-container"},type:"waitcss",waitTime:"250"}],type:"list"},name:"OPEN_OPTIONS"},{action:{actions:[{consents:[{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Information storage and access","Opbevaring af og adgang til oplysninger på din enhed"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Information storage and access","Opbevaring af og adgang til oplysninger på din enhed"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"D"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personlige annoncer","Personalisation"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personlige annoncer","Personalisation"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"E"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Annoncevalg, levering og rapportering","Ad selection, delivery, reporting"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Annoncevalg, levering og rapportering","Ad selection, delivery, reporting"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"F"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personalisering af indhold","Content selection, delivery, reporting"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personalisering af indhold","Content selection, delivery, reporting"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"E"},{matcher:{parent:{childFilter:{target:{selector:".as-oil-cpc__purpose-header",textFilter:["Måling","Measurement"]}},selector:".as-oil-cpc__purpose-container"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{childFilter:{target:{selector:".as-oil-cpc__purpose-header",textFilter:["Måling","Measurement"]}},selector:".as-oil-cpc__purpose-container"},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"B"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:"Google"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:"Google"},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"F"}],type:"consent"}],type:"list"},name:"DO_CONSENT"},{action:{target:{selector:".as-oil__btn-optin"},type:"click"},name:"SAVE_CONSENT"},{action:{target:{selector:"div.as-oil"},type:"hide"},name:"HIDE_CMP"}]},optanon:{detectors:[{presentMatcher:{target:{selector:"#optanon-menu, .optanon-alert-box-wrapper"},type:"css"},showingMatcher:{target:{displayFilter:!0,selector:".optanon-alert-box-wrapper"},type:"css"}}],methods:[{action:{actions:[{target:{selector:".optanon-alert-box-wrapper .optanon-toggle-display, a[onclick*='OneTrust.ToggleInfoDisplay()'], a[onclick*='Optanon.ToggleInfoDisplay()']"},type:"click"}],type:"list"},name:"OPEN_OPTIONS"},{action:{actions:[{target:{selector:".preference-menu-item #Your-privacy"},type:"click"},{target:{selector:"#optanon-vendor-consent-text"},type:"click"},{action:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"X"}],type:"consent"},target:{selector:"#optanon-vendor-consent-list .vendor-item"},type:"foreach"},{target:{selector:".vendor-consent-back-link"},type:"click"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-performance"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-performance"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-functional"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-functional"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-advertising"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-advertising"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-social"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-social"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Social Media Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Social Media Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalisation"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalisation"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Site monitoring cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Site monitoring cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Third party privacy-enhanced content"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Third party privacy-enhanced content"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"X"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Performance & Advertising Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Performance & Advertising Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Information storage and access"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Information storage and access"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"D"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad selection, delivery, reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad selection, delivery, reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content selection, delivery, reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content selection, delivery, reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Measurement"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Measurement"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Recommended Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Recommended Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"X"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Unclassified Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Unclassified Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"X"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Analytical Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Analytical Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Marketing Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Marketing Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalization"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalization"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad Selection, Delivery & Reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad Selection, Delivery & Reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content Selection, Delivery & Reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content Selection, Delivery & Reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"}],type:"list"},name:"DO_CONSENT"},{action:{parent:{selector:".optanon-save-settings-button"},target:{selector:".optanon-white-button-middle"},type:"click"},name:"SAVE_CONSENT"},{action:{actions:[{target:{selector:"#optanon-popup-wrapper"},type:"hide"},{target:{selector:"#optanon-popup-bg"},type:"hide"},{target:{selector:".optanon-alert-box-wrapper"},type:"hide"}],type:"list"},name:"HIDE_CMP"}]},quantcast2:{detectors:[{presentMatcher:{target:{selector:"[data-tracking-opt-in-overlay]"},type:"css"},showingMatcher:{target:{selector:"[data-tracking-opt-in-overlay] [data-tracking-opt-in-learn-more]"},type:"css"}}],methods:[{action:{target:{selector:"[data-tracking-opt-in-overlay] [data-tracking-opt-in-learn-more]"},type:"click"},name:"OPEN_OPTIONS"},{action:{actions:[{type:"wait",waitTime:500},{action:{actions:[{target:{selector:"div",textFilter:["Information storage and access"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"D"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Personalization"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"F"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Ad selection, delivery, reporting"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"F"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Content selection, delivery, reporting"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"E"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Measurement"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"B"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Other Partners"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"X"}],type:"consent"},type:"ifcss"}],type:"list"},parent:{childFilter:{target:{selector:"input"}},selector:"[data-tracking-opt-in-overlay] > div > div"},target:{childFilter:{target:{selector:"input"}},selector:":scope > div"},type:"foreach"}],type:"list"},name:"DO_CONSENT"},{action:{target:{selector:"[data-tracking-opt-in-overlay] [data-tracking-opt-in-save]"},type:"click"},name:"SAVE_CONSENT"}]},springer:{detectors:[{presentMatcher:{parent:null,target:{selector:".cmp-app_gdpr"},type:"css"},showingMatcher:{parent:null,target:{displayFilter:!0,selector:".cmp-popup_popup"},type:"css"}}],methods:[{action:{actions:[{target:{selector:".cmp-intro_rejectAll"},type:"click"},{type:"wait",waitTime:250},{target:{selector:".cmp-purposes_purposeItem:not(.cmp-purposes_selectedPurpose)"},type:"click"}],type:"list"},name:"OPEN_OPTIONS"},{action:{consents:[{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Przechowywanie informacji na urządzeniu lub dostęp do nich",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Przechowywanie informacji na urządzeniu lub dostęp do nich",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"D"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór podstawowych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór podstawowych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"F"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"F"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"E"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"E"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"B"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"B"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"B"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Stosowanie badań rynkowych w celu generowania opinii odbiorców",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Stosowanie badań rynkowych w celu generowania opinii odbiorców",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"X"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Opracowywanie i ulepszanie produktów",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Opracowywanie i ulepszanie produktów",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"X"}],type:"consent"},name:"DO_CONSENT"},{action:{target:{selector:".cmp-details_save"},type:"click"},name:"SAVE_CONSENT"}]},wordpressgdpr:{detectors:[{presentMatcher:{parent:null,target:{selector:".wpgdprc-consent-bar"},type:"css"},showingMatcher:{parent:null,target:{displayFilter:!0,selector:".wpgdprc-consent-bar"},type:"css"}}],methods:[{action:{parent:null,target:{selector:".wpgdprc-consent-bar .wpgdprc-consent-bar__settings",textFilter:null},type:"click"},name:"OPEN_OPTIONS"},{action:{actions:[{target:{selector:".wpgdprc-consent-modal .wpgdprc-button",textFilter:"Eyeota"},type:"click"},{consents:[{description:"Eyeota Cookies",matcher:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Eyeota"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Eyeota"},target:{selector:"label"},type:"click"},type:"X"}],type:"consent"},{target:{selector:".wpgdprc-consent-modal .wpgdprc-button",textFilter:"Advertising"},type:"click"},{consents:[{description:"Advertising Cookies",matcher:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Advertising"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Advertising"},target:{selector:"label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},name:"DO_CONSENT"},{action:{parent:null,target:{selector:".wpgdprc-button",textFilter:"Save my settings"},type:"click"},name:"SAVE_CONSENT"}]}},P={autoconsent:A,consentomatic:S},O=Object.freeze({__proto__:null,autoconsent:A,consentomatic:S,default:P});if(window.autoconsentReceiveMessage)console.warn("autoconsent already initialized",window.autoconsentReceiveMessage);else{const e=new x(window.autoconsentSendMessage,null,O);window.autoconsentReceiveMessage=t=>Promise.resolve(e.receiveMessageCallback(t))}}();
package/lib/cmps/all.ts CHANGED
@@ -1,23 +1,28 @@
1
- import { AutoConsent } from './base';
2
- import TrustArc from './trustarc';
1
+ import { AutoConsentCMP } from './base';
2
+ import TrustArcTop from './trustarc-top';
3
+ import TrustArcFrame from './trustarc-frame';
3
4
  import CookieBot from './cookiebot';
4
- import SourcePoint from './sourcepoint';
5
- import ContentManager from './consentmanager';
5
+ import SourcePointTop from './sourcepoint-top';
6
+ import SourcePointFrame from './sourcepoint-frame';
7
+ import ConsentManager from './consentmanager';
6
8
  import Evidon from './evidon';
7
9
  import { AutoConsentCMPRule } from '../rules';
8
10
  import Onetrust from './onetrust';
11
+ import { AutoCMP } from '../types';
9
12
 
10
- const rules = [
11
- new TrustArc(),
13
+ const rules: AutoCMP[] = [
14
+ new TrustArcTop(),
15
+ new TrustArcFrame(),
12
16
  new CookieBot(),
13
- new SourcePoint(),
14
- new ContentManager(),
17
+ new SourcePointTop(),
18
+ new SourcePointFrame(),
19
+ new ConsentManager(),
15
20
  new Evidon(),
16
21
  new Onetrust(),
17
22
  ];
18
23
 
19
- export function createAutoCMP(config: AutoConsentCMPRule): AutoConsent {
20
- return new AutoConsent(config);
24
+ export function createAutoCMP(config: AutoConsentCMPRule): AutoConsentCMP {
25
+ return new AutoConsentCMP(config);
21
26
  }
22
27
 
23
28
  export default rules;
package/lib/cmps/base.ts CHANGED
@@ -1,21 +1,9 @@
1
1
  /* eslint-disable no-restricted-syntax,no-await-in-loop,no-underscore-dangle */
2
2
 
3
- import { AutoCMP, TabActor } from "../types";
4
- import { AutoConsentCMPRule, AutoConsentRuleStep } from "../rules";
3
+ import { AutoCMP } from "../types";
4
+ import { AutoConsentCMPRule, AutoConsentRuleStep, RunContext } from "../rules";
5
5
  import { enableLogs } from "../config";
6
-
7
- export async function waitFor(predicate: () => Promise<boolean> | boolean, maxTimes: number, interval: number): Promise<boolean> {
8
- let result = await predicate();
9
- if (!result && maxTimes > 0) {
10
- return new Promise((resolve) => {
11
- setTimeout(async () => {
12
- resolve(waitFor(predicate, maxTimes - 1, interval));
13
- }, interval);
14
- });
15
- }
16
- return Promise.resolve(result);
17
- }
18
-
6
+ import { click, doEval, elementExists, elementVisible, hide, wait, waitForElement, waitForThenClick, waitForVisible } from "../rule-executors";
19
7
 
20
8
  export async function success(action: Promise<boolean>): Promise<boolean> {
21
9
  const result = await action;
@@ -25,124 +13,147 @@ export async function success(action: Promise<boolean>): Promise<boolean> {
25
13
  return result
26
14
  }
27
15
 
16
+ export const defaultRunContext: RunContext = {
17
+ main: true,
18
+ frame: false,
19
+ url: "",
20
+ }
28
21
 
29
- export default class AutoConsentBase implements AutoCMP {
22
+ export default class AutoConsentCMPBase implements AutoCMP {
30
23
 
31
24
  name: string
32
- hasSelfTest = true
25
+ runContext: RunContext = defaultRunContext;
33
26
 
34
27
  constructor(name: string) {
35
28
  this.name = name;
36
29
  }
37
30
 
38
- detectCmp(tab: TabActor): Promise<boolean> {
31
+ get hasSelfTest(): boolean {
39
32
  throw new Error('Not Implemented');
40
33
  }
41
34
 
42
- async detectPopup(tab: TabActor) {
43
- return false;
35
+ get isIntermediate(): boolean {
36
+ throw new Error('Not Implemented');
37
+ }
38
+
39
+ checkRunContext(): boolean {
40
+ const runCtx: RunContext = {
41
+ ...defaultRunContext,
42
+ ...this.runContext,
43
+ }
44
+
45
+ const isTop = window.top === window;
46
+
47
+ if (isTop && !runCtx.main) {
48
+ return false;
49
+ }
50
+
51
+ if (!isTop && !runCtx.frame) {
52
+ return false;
53
+ }
54
+
55
+ if (runCtx.url && !window.location.href.startsWith(runCtx.url)) {
56
+ return false;
57
+ }
58
+ return true;
59
+ }
60
+
61
+ detectCmp(): Promise<boolean> {
62
+ throw new Error('Not Implemented');
44
63
  }
45
64
 
46
- detectFrame(tab: TabActor, frame: { url: string }) {
65
+ async detectPopup() {
47
66
  return false;
48
67
  }
49
68
 
50
- optOut(tab: TabActor): Promise<boolean> {
69
+ optOut(): Promise<boolean> {
51
70
  throw new Error('Not Implemented');
52
71
  }
53
72
 
54
- optIn(tab: TabActor): Promise<boolean> {
73
+ optIn(): Promise<boolean> {
55
74
  throw new Error('Not Implemented');
56
75
  }
57
76
 
58
- openCmp(tab: TabActor): Promise<boolean> {
77
+ openCmp(): Promise<boolean> {
59
78
  throw new Error('Not Implemented');
60
79
  }
61
80
 
62
- async test(tab: TabActor): Promise<boolean> {
81
+ async test(): Promise<boolean> {
63
82
  // try IAB by default
64
83
  return Promise.resolve(true);
65
84
  }
66
85
  }
67
86
 
68
- async function evaluateRule(rule: AutoConsentRuleStep, tab: TabActor) {
69
- if (rule.frame && !tab.frame) {
70
- await waitFor(() => Promise.resolve(!!tab.frame), 10, 500);
71
- }
72
- const frameId = rule.frame && tab.frame ? tab.frame.id : undefined;
87
+ async function evaluateRuleStep(rule: AutoConsentRuleStep) {
73
88
  const results = [];
74
89
  if (rule.exists) {
75
- results.push(tab.elementExists(rule.exists, frameId));
90
+ results.push(elementExists(rule.exists));
76
91
  }
77
92
  if (rule.visible) {
78
- results.push(tab.elementsAreVisible(rule.visible, rule.check, frameId));
93
+ results.push(elementVisible(rule.visible, rule.check));
79
94
  }
80
95
  if (rule.eval) {
81
- results.push(new Promise(async (resolve) => {
82
- // catch eval error silently
83
- try {
84
- resolve(await tab.eval(rule.eval!, frameId));
85
- } catch (e) {
86
- resolve(false);
87
- }
88
- }));
96
+ const res = doEval(rule.eval)
97
+ results.push(res);
89
98
  }
90
99
  if (rule.waitFor) {
91
- results.push(tab.waitForElement(rule.waitFor, rule.timeout || 10000, frameId));
100
+ results.push(waitForElement(rule.waitFor, rule.timeout));
101
+ }
102
+ if (rule.waitForVisible) {
103
+ results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
92
104
  }
93
105
  if (rule.click) {
94
- if (rule.all === true) {
95
- results.push(tab.clickElements(rule.click, frameId));
96
- } else {
97
- results.push(tab.clickElement(rule.click, frameId));
98
- }
106
+ results.push(click(rule.click, rule.all));
99
107
  }
100
108
  if (rule.waitForThenClick) {
101
- results.push(tab.waitForElement(rule.waitForThenClick, rule.timeout || 10000, frameId)
102
- .then(() => tab.clickElement(rule.waitForThenClick!, frameId)));
109
+ results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
103
110
  }
104
111
  if (rule.wait) {
105
- results.push(tab.wait(rule.wait));
106
- }
107
- if (rule.goto) {
108
- results.push(tab.goto(rule.goto));
112
+ results.push(wait(rule.wait));
109
113
  }
110
114
  if (rule.hide) {
111
- results.push(tab.hideElements(rule.hide, frameId));
112
- }
113
- if (rule.undoHide) {
114
- results.push(tab.undoHideElements(frameId));
115
+ results.push(hide(rule.hide, rule.method));
115
116
  }
116
- if (rule.waitForFrame) {
117
- results.push(waitFor(() => !!tab.frame, 40, 500))
117
+
118
+ if (results.length === 0) {
119
+ enableLogs && console.warn('Unrecognized rule', rule);
120
+ return false;
118
121
  }
122
+
119
123
  // boolean and of results
120
- return (await Promise.all(results)).reduce((a, b) => a && b, true);
124
+ const all = await Promise.all(results);
125
+ return all.reduce((a, b) => a && b, true);
121
126
  }
122
127
 
123
- export class AutoConsent extends AutoConsentBase {
128
+ export class AutoConsentCMP extends AutoConsentCMPBase {
124
129
 
125
130
  constructor(public config: AutoConsentCMPRule) {
126
131
  super(config.name);
132
+ this.runContext = config.runContext || defaultRunContext;
127
133
  }
128
134
 
129
- get prehideSelectors(): string[] {
130
- return this.config.prehideSelectors;
135
+ get hasSelfTest(): boolean {
136
+ return !!this.config.test;
131
137
  }
132
138
 
133
- get isHidingRule(): boolean {
134
- return this.config.isHidingRule;
139
+ get isIntermediate(): boolean {
140
+ return !!this.config.intermediate;
141
+ }
142
+
143
+ get prehideSelectors(): string[] {
144
+ return this.config.prehideSelectors;
135
145
  }
136
146
 
137
- async _runRulesParallel(tab: TabActor, rules: AutoConsentRuleStep[]): Promise<boolean> {
138
- const detections = await Promise.all(rules.map(rule => evaluateRule(rule, tab)));
147
+ async _runRulesParallel(rules: AutoConsentRuleStep[]): Promise<boolean> {
148
+ const results = rules.map(rule => evaluateRuleStep(rule));
149
+ const detections = await Promise.all(results);
139
150
  return detections.every(r => !!r);
140
151
  }
141
152
 
142
- async _runRulesSequentially(tab: TabActor, rules: AutoConsentRuleStep[]): Promise<boolean> {
153
+ async _runRulesSequentially(rules: AutoConsentRuleStep[]): Promise<boolean> {
143
154
  for (const rule of rules) {
144
- enableLogs && console.log('Running rule...', rule, tab.id);
145
- const result = await evaluateRule(rule, tab);
155
+ enableLogs && console.log('Running rule...', rule);
156
+ const result = await evaluateRuleStep(rule);
146
157
  enableLogs && console.log('...rule result', result);
147
158
  if (!result && !rule.optional) {
148
159
  return false;
@@ -151,53 +162,47 @@ export class AutoConsent extends AutoConsentBase {
151
162
  return true;
152
163
  }
153
164
 
154
- async detectCmp(tab: TabActor) {
165
+ async detectCmp() {
155
166
  if (this.config.detectCmp) {
156
- return this._runRulesParallel(tab, this.config.detectCmp);
167
+ return this._runRulesParallel(this.config.detectCmp);
157
168
  }
158
169
  return false;
159
170
  }
160
171
 
161
- async detectPopup(tab: TabActor) {
172
+ async detectPopup() {
162
173
  if (this.config.detectPopup) {
163
- return this._runRulesParallel(tab, this.config.detectPopup);
164
- }
165
- return false;
166
- }
167
-
168
- detectFrame(tab: TabActor, frame: { url: string }) {
169
- if (this.config.frame) {
170
- return frame.url.startsWith(this.config.frame);
174
+ return this._runRulesParallel(this.config.detectPopup);
171
175
  }
172
176
  return false;
173
177
  }
174
178
 
175
- async optOut(tab: TabActor) {
179
+ async optOut() {
176
180
  if (this.config.optOut) {
177
181
  enableLogs && console.log('Initiated optOut()', this.config.optOut);
178
- return this._runRulesSequentially(tab, this.config.optOut);
182
+ return this._runRulesSequentially(this.config.optOut);
179
183
  }
180
184
  return false;
181
185
  }
182
186
 
183
- async optIn(tab: TabActor) {
187
+ async optIn() {
184
188
  if (this.config.optIn) {
185
- return this._runRulesSequentially(tab, this.config.optIn);
189
+ enableLogs && console.log('Initiated optIn()', this.config.optIn);
190
+ return this._runRulesSequentially(this.config.optIn);
186
191
  }
187
192
  return false;
188
193
  }
189
194
 
190
- async openCmp(tab: TabActor) {
195
+ async openCmp() {
191
196
  if (this.config.openCmp) {
192
- return this._runRulesSequentially(tab, this.config.openCmp);
197
+ return this._runRulesSequentially(this.config.openCmp);
193
198
  }
194
199
  return false;
195
200
  }
196
201
 
197
- async test(tab: TabActor) {
198
- if (this.config.test) {
199
- return this._runRulesSequentially(tab, this.config.test);
202
+ async test() {
203
+ if (this.hasSelfTest) {
204
+ return this._runRulesSequentially(this.config.test);
200
205
  }
201
- return super.test(tab);
206
+ return super.test();
202
207
  }
203
208
  }
@@ -1,39 +1,51 @@
1
- import AutoConsentBase from "./base";
2
- import { TabActor } from "../types";
1
+ import { click, elementExists, elementVisible, waitForElement } from "../rule-executors";
2
+ import AutoConsentCMPBase from "./base";
3
3
 
4
4
  // Note: JS API is also available:
5
5
  // https://help.consentmanager.net/books/cmp/page/javascript-api
6
- export default class ConsentManager extends AutoConsentBase {
6
+ export default class ConsentManager extends AutoConsentCMPBase {
7
7
 
8
8
  prehideSelectors = ["#cmpbox,#cmpbox2"]
9
9
 
10
+ get hasSelfTest(): boolean {
11
+ return false;
12
+ }
13
+
14
+ get isIntermediate(): boolean {
15
+ return false;
16
+ }
17
+
10
18
  constructor() {
11
19
  super("consentmanager.net");
12
20
  }
13
21
 
14
- detectCmp(tab: TabActor) {
15
- return tab.elementExists("#cmpbox");
22
+ async detectCmp() {
23
+ return elementExists("#cmpbox");
16
24
  }
17
25
 
18
- detectPopup(tab: TabActor) {
19
- return tab.elementsAreVisible("#cmpbox .cmpmore", "any");
26
+ async detectPopup() {
27
+ return elementVisible("#cmpbox .cmpmore", 'any');
20
28
  }
21
29
 
22
- async optOut(tab: TabActor) {
23
- if (await tab.elementExists(".cmpboxbtnno")) {
24
- return tab.clickElement(".cmpboxbtnno");
30
+ async optOut() {
31
+ if (click(".cmpboxbtnno")) {
32
+ return true;
25
33
  }
26
- if (await tab.elementExists(".cmpwelcomeprpsbtn")) {
27
- await tab.clickElements(".cmpwelcomeprpsbtn > a[aria-checked=true]");
28
- return await tab.clickElement(".cmpboxbtnsave");
34
+
35
+ if (elementExists(".cmpwelcomeprpsbtn")) {
36
+ click(".cmpwelcomeprpsbtn > a[aria-checked=true]", true);
37
+ click(".cmpboxbtnsave");
38
+ return true;
29
39
  }
30
- await tab.clickElement(".cmpboxbtncustom");
31
- await tab.waitForElement(".cmptblbox", 2000);
32
- await tab.clickElements(".cmptdchoice > a[aria-checked=true]");
33
- return tab.clickElement(".cmpboxbtnyescustomchoices");
40
+
41
+ click(".cmpboxbtncustom");
42
+ await waitForElement(".cmptblbox", 2000);
43
+ click(".cmptdchoice > a[aria-checked=true]", true);
44
+ click(".cmpboxbtnyescustomchoices");
45
+ return true;
34
46
  }
35
47
 
36
- async optIn(tab: TabActor) {
37
- return tab.clickElement(".cmpboxbtnyes");
48
+ async optIn() {
49
+ return click(".cmpboxbtnyes");
38
50
  }
39
51
  }