@finsweet/consentpro-scan 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/results.js +1 -1
- package/package.json +13 -25
package/dist/results.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var re=Object.defineProperty;var ie=(t,e,o)=>e in t?re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var H=(t,e,o)=>ie(t,typeof e!="symbol"?e+"":e,o);var E=t=>t.type==="script"||t.type==="iframe"||t.type==="link"||t.type==="noscript",R=t=>t.type==="cookie"||t.type==="local-storage"||t.type==="session-storage",ae=[{id:"cookieyes",name:"CookieYes",patterns:{scripts:[/cookieyes\.com/i,/cookie-law-info/i],cookies:[/cookieyes-consent/i,/cky-consent/i,/cookielawinfo/i],dom:[/cky-consent/i,/cookie-law-info/i]}},{id:"termly",name:"Termly",patterns:{scripts:[/termly\.io/i,/termly-embed/i],cookies:[/termly/i],dom:[/termly/i]}},{id:"consentmanager",name:"Consentmanager.net",patterns:{scripts:[/consentmanager\.net/i,/consent-manager/i],cookies:[/consentmanager/i,/cmapi/i],dom:[/consent-manager/i]}},{id:"enzuzo",name:"Enzuzo",patterns:{scripts:[/enzuzo\.com/i],cookies:[/enzuzo/i],dom:[/enzuzo/i]}},{id:"cookiebot",name:"Cookiebot (by Usercentrics)",patterns:{scripts:[/cookiebot\.com/i,/consent\.cookiebot/i],cookies:[/CookieConsent/i,/cookiebot/i],dom:[/CookieConsent/i,/cookiebot/i]}},{id:"iubenda",name:"Iubenda",patterns:{scripts:[/iubenda\.com/i,/iubenda_cs/i],cookies:[/_iub_cs/i,/iubenda/i],dom:[/iubenda/i,/_iub_cs/i]}},{id:"osano",name:"Osano",patterns:{scripts:[/osano\.com/i],cookies:[/osano/i],dom:[/osano/i]}},{id:"usercentrics",name:"Usercentrics",patterns:{scripts:[/usercentrics\.eu/i,/usercentrics\.com/i],cookies:[/usercentrics/i,/uc_user_interaction/i],dom:[/usercentrics/i]}},{id:"cookiescript",name:"CookieScript",patterns:{scripts:[/cookiescript\.com/i,/cookie-script/i],cookies:[/CookieScriptConsent/i],dom:[/cookie-script/i]}},{id:"secureprivacy",name:"Secure Privacy",patterns:{scripts:[/secureprivacy\.ai/i],cookies:[/secureprivacy/i],dom:[/secureprivacy/i]}},{id:"onetrust",name:"OneTrust",patterns:{scripts:[/onetrust\.com/i,/optanon/i],cookies:[/OptanonConsent/i,/OptanonAlertBoxClosed/i],dom:[/onetrust/i,/optanon/i]}},{id:"trustarc",name:"TrustArc",patterns:{scripts:[/trustarc\.com/i,/truste\.com/i],cookies:[/truste/i,/notice_behavior/i],dom:[/truste/i]}},{id:"axeptio",name:"Axeptio",patterns:{scripts:[/axept\.io/i,/static\.axept\.io/i],cookies:[/axeptio_/i,/axeptio/i],dom:[/axeptio/i]}},{id:"complianz",name:"Complianz",patterns:{scripts:[/complianz/i],cookies:[/complianz/i,/cmplz/i],dom:[/complianz/i,/cmplz/i]}},{id:"quantcast",name:"Quantcast",patterns:{scripts:[/quantcast/i,/quantserve/i],cookies:[/quantcast/i,/__qca/i],dom:[/quantcast/i]}},{id:"cookieconsent-termsfeed",name:"Cookie Consent by TermsFeed",patterns:{scripts:[/cookieconsent\.com/i,/termsfeed\.com/i],cookies:[/cc_cookie/i],dom:[/cookieconsent/i]}},{id:"finsweet-fs-cc",name:"Finsweet [fs-cc] Consent",patterns:{scripts:[/@finsweet\/cookie-consent/i,/fs-cc\.js/i],cookies:[/fs-cc/i,/finsweet.*cookie/i],dom:[/fs-cc-(mode|src|category|placeholder)\s*=/i,/(?:^|[^-])fs-cc(?:[^-]|$)/i,/fs-consent-element/i,/fs-consent_banner/i]}},{id:"finsweet-cookie-consent",name:"Finsweet Cookie Consent | Finsweet Consent Pro",patterns:{scripts:[/@finsweet\/fs-components/i,/finsweet.*cookie-consent/i,/fs-cc\.js/i],cookies:[/fs-consent/i,/(?:^|[^-])fs-cc(?:[^-]|$)/i,/(?:^|[^-])fs-consent(?:[^-]|$)/i,/finsweet.*cookie/i],dom:[/fs-components-installed\s*=\s*["']consent["']/i,/(?:^|[^-])fs-cc(?:[^-]|$)/i,/(?:^|[^-])fs-consent(?:[^-]|$)/i,/fs-consent-element/i,/fs-consent_banner/i]}}],_=/youtube\.com|youtu\.be|vimeo\.com|player\.vimeo/i,U=/maps\.google|maps\.googleapis|google\.com\/maps/i,O=/fonts\.googleapis\.com|fonts\.gstatic\.com/i,j=/googletagmanager\.com|gtm\.js/i,ce=/cdn\.intellimize\.co\/snippet\/\d+\.js/i,z=/intellimize/i,I={ga4:{pattern:/gtag|gtm\.js|googletagmanager|analytics\.js|ga\.js/i,name:"Google Analytics",category:"analytics"},gtm:{pattern:/googletagmanager\.com\/gtm\.js/i,name:"Google Tag Manager",category:"analytics"},metaPixel:{pattern:/connect\.facebook\.net|fbevents\.js|fb-pixel/i,name:"Meta Pixel",category:"marketing"},bingUET:{pattern:/bat\.bing\.com/i,name:"Bing UET",category:"marketing"},googleAds:{pattern:/googleadservices\.com|googlesyndication|pagead2/i,name:"Google Ads",category:"marketing"},hotjar:{pattern:/hotjar\.com|static\.hotjar/i,name:"Hotjar",category:"analytics"},clarity:{pattern:/clarity\.ms/i,name:"Microsoft Clarity",category:"analytics"},linkedin:{pattern:/snap\.licdn\.com|linkedin.*insight/i,name:"LinkedIn Insight",category:"marketing"},twitter:{pattern:/static\.ads-twitter\.com/i,name:"Twitter Pixel",category:"marketing"},tiktok:{pattern:/analytics\.tiktok\.com/i,name:"TikTok Pixel",category:"marketing"},pinterest:{pattern:/pintrk|pinterest.*tag/i,name:"Pinterest Tag",category:"marketing"},hubspot:{pattern:/js\.hs-scripts\.com|js\.hubspot\.com/i,name:"HubSpot",category:"marketing"},intercom:{pattern:/widget\.intercom\.io/i,name:"Intercom",category:"marketing"},segment:{pattern:/segment\.com|segment\.io/i,name:"Segment",category:"analytics"},mixpanel:{pattern:/mixpanel\.com/i,name:"Mixpanel",category:"analytics"},amplitude:{pattern:/amplitude\.com/i,name:"Amplitude",category:"analytics"},heap:{pattern:/heap-analytics|heapanalytics/i,name:"Heap Analytics",category:"analytics"},youtube:{pattern:/youtube\.com|youtu\.be/i,name:"YouTube Embed",category:"marketing"},vimeo:{pattern:/vimeo\.com|player\.vimeo/i,name:"Vimeo Embed",category:"marketing"}};function F(t){let e=[];e.push(le(t)),e.push(me(t)),e.push(pe(t)),e.push(N(t)),e.push(ue(t)),e.push({id:"script-head-placement",name:"Script Head Placement",description:"Verify consent script is placed at the top of <head> section",status:"not-verifiable",details:"Cannot be verified from scan results. Manual review required."}),e.push(de(t)),e.push({id:"auto-placeholder",name:"Auto-placeholder Support",description:"Check if blocked videos have placeholder elements",status:"not-verifiable",details:"Cannot be verified from scan results. Manual review required."});let o={passed:e.filter(l=>l.status==="pass").length,failed:e.filter(l=>l.status==="fail").length,warnings:e.filter(l=>l.status==="warning").length,notVerifiable:e.filter(l=>l.status==="not-verifiable").length},s=e.filter(l=>l.status!=="not-verifiable");if(s.length===0)return{overallScore:0,hasViolations:o.failed>0,criteria:e,summary:o};let n=["consent-tool"],r=0,i=0;for(let l of s){let p=n.includes(l.id)?2:1,g=l.status==="pass"?1:l.status==="warning"?.5:0;r+=g*p,i+=p}return{overallScore:Math.round(r/i*100),hasViolations:o.failed>0,criteria:e,summary:o}}function M(t){if(!t.results)throw new Error("No results found in response for compliance evaluation");return F(t.results)}function le(t){let e=t.detectedItems.filter(E).filter(n=>_.test(n.domain)||_.test(n.source)),o=e.map(n=>n.id);if(e.length===0)return{id:"video-embeds",name:"YouTube/Vimeo Detection",description:"Detect YouTube or Vimeo video embeds that may store cookies",status:"pass",details:"No YouTube or Vimeo embeds detected."};let s=e.filter(n=>n.isThirdParty);return{id:"video-embeds",name:"YouTube/Vimeo Detection",description:"Detect YouTube or Vimeo video embeds that may store cookies",status:"fail",details:`Found ${e.length} video embed(s) from YouTube/Vimeo. ${s.length} are third-party resources that may store cookies before consent.`,affectedItems:o}}function me(t){let e=t.detectedItems.filter(E).filter(s=>U.test(s.domain)||U.test(s.source)),o=e.map(s=>s.id);return e.length===0?{id:"google-maps",name:"Google Maps Detection",description:"Detect Google Maps embeds that may store cookies",status:"pass",details:"No Google Maps embeds detected."}:{id:"google-maps",name:"Google Maps Detection",description:"Detect Google Maps embeds that may store cookies",status:"fail",details:`Found ${e.length} Google Maps embed(s) that may store cookies before consent.`,affectedItems:o}}function pe(t){let e=t.detectedItems.filter(E).filter(s=>O.test(s.domain)||O.test(s.source)),o=e.map(s=>s.id);return e.length===0?{id:"google-fonts",name:"Google Fonts Detection",description:"Detect Google Fonts which transfer IP addresses to Google servers without consent",status:"pass",details:"No Google Fonts detected. Website may be using self-hosted fonts."}:{id:"google-fonts",name:"Google Fonts Detection",description:"Detect Google Fonts which transfer IP addresses to Google servers without consent",status:"fail",details:`Found ${e.length} Google Fonts resource(s). This transfers visitor IP addresses to Google without consent, which is a GDPR violation. Fonts should be self-hosted or loaded only after consent.`,affectedItems:o}}function N(t){let e=[],o=new Map;for(let n of ae){let r=0;if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let i of t.detectedItems)if(E(i)&&i.type==="script"){let{source:a}=i,l=i.element?.outerHTML||"";for(let p of n.patterns.scripts)if(p.test(a)||p.test(l)){r+=1,e.includes(i.id)||e.push(i.id);break}}}if(t.trackersInfo?.providers&&Array.isArray(t.trackersInfo.providers))for(let i of t.trackersInfo.providers){let a=i.name||"";for(let l of n.patterns.scripts)if(l.test(a)){r+=1,e.includes(i.id)||e.push(i.id);break}}if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let i of t.detectedItems)if(R(i)&&i.type==="cookie"){let{name:a}=i;for(let l of n.patterns.cookies)if(l.test(a)){r+=1,e.includes(i.id)||e.push(i.id);break}}}if(t.detectedItems&&Array.isArray(t.detectedItems))for(let i of t.detectedItems){let l=E(i)&&i.element?.outerHTML||"";for(let p of n.patterns.dom)if(p.test(l)){r+=1,e.includes(i.id)||e.push(i.id);break}}r>0&&o.set(n.name,r)}let s=Array.from(o.entries()).sort((n,r)=>r[1]-n[1]).map(([n])=>n);return s.length===0?{id:"consent-tool",name:"\u26A0\uFE0F Consent Tool Detection",description:"Check if a cookie consent management tool is installed",status:"fail",details:"No cookie consent tool detected. A consent banner is required for GDPR compliance."}:{id:"consent-tool",name:"Consent Tool Detection",description:"Check if a cookie consent management tool is installed",status:"pass",details:`Detected consent tool(s): ${s.join(", ")}`,affectedItems:e}}function ue(t){let e=t.detectedItems.filter(s=>{if(!E(s)||s.category!=="uncategorized"||!s.isThirdParty)return!1;let n=s.domain??"",r=s.source??"";return!(j.test(n)||j.test(r))}),o=e.map(s=>s.id);return e.length===0?{id:"uncategorized-trackers",name:"Uncategorized Third-Party Trackers",description:"Check for third-party resources without proper categorization",status:"pass",details:"All third-party resources are properly categorized."}:{id:"uncategorized-trackers",name:"Uncategorized Third-Party Trackers",description:"Check for third-party resources without proper categorization",status:"fail",details:`Found ${e.length} uncategorized third-party resource(s). These should be reviewed and categorized for proper consent management.`,affectedItems:o}}function de(t){let e=t.detectedItems??[];if(!e.some(l=>E(l)&&l.type==="script"&&ce.test(l.source)))return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"pass",details:"Webflow Optimize/Analyze (Intellimize) not detected."};if(N(t).status!=="pass")return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"pass",details:"Webflow Optimize detected; no CMP\u2014consent-gating not applicable."};let n=e.filter(l=>R(l)&&l.type==="cookie"&&z.test(l.name)),r=e.filter(l=>R(l)&&l.type==="session-storage"&&z.test(l.name)),i=e.filter(l=>R(l)&&l.type==="local-storage"&&z.test(l.name)),a=[];if(n.length>0&&a.push(`${n.length} cookie(s)`),r.length>0&&a.push(`${r.length} session-storage key(s)`),i.length>0&&a.push(`${i.length} local-storage key(s)`),a.length>0){let l=[...n.map(p=>p.id),...r.map(p=>p.id),...i.map(p=>p.id)];return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"fail",details:`Intellimize cookies/storage present despite CMP: ${a.join(", ")}.`,affectedItems:l}}return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"pass",details:"Webflow Optimize detected; CMP present and no Intellimize cookies or storage detected."}}function $(t){let e=N(t);return e.status!=="pass"||!e.details?null:e.details.match(/Detected consent tool\(s\): (.+)/)?.[1]?.trim()??null}function V(t){return F(t).criteria.filter(o=>o.status==="fail").map(o=>`${o.name}: ${o.details}`)}function G(t){let e=[],o=t.detectedItems??[],s=o.filter(E),n=o.filter(R),r=s.some(m=>m.type==="script"&&m.isThirdParty&&I.ga4.pattern.test(m.source)),i=s.some(m=>m.type==="script"&&m.isThirdParty&&I.metaPixel.pattern.test(m.source)),a=s.some(m=>m.type==="script"&&m.isThirdParty&&I.bingUET.pattern.test(m.source)),l=s.some(m=>m.type==="script"&&m.isThirdParty&&I.hotjar.pattern.test(m.source)),p=s.some(m=>m.type==="script"&&m.isThirdParty&&I.clarity.pattern.test(m.source));r&&e.push("\u{1F534} Google Analytics/GTM is running before user consent"),i&&e.push("\u{1F534} Meta Pixel is firing before user consent"),a&&e.push("\u{1F534} Bing UET tag loads pre-consent"),l&&e.push("\u{1F534} Hotjar is tracking before consent"),p&&e.push("\u{1F534} Microsoft Clarity runs pre-consent");let g=n.filter(m=>m.type==="cookie"&&m.category!=="essential"&&m.category!=="necessary");g.length>0&&e.push(`\u{1F36A} ${g.length} non-essential cookies set before consent`);let u=n.filter(m=>(m.type==="local-storage"||m.type==="session-storage")&&m.category!=="essential"&&m.category!=="necessary");return u.length>0&&e.push(`\u{1F4BE} ${u.length} localStorage/sessionStorage items set pre-consent`),$(t)||e.push("\u26A0\uFE0F No consent management platform detected"),e}var fe=localStorage.getItem("cs-dev")==="true",L=fe?"http://127.0.0.1:8787":"https://fs-consentpro-api-dev.finsweet.workers.dev",ot=1440*60*1e3;var f={success:"#07601d",warning:"#bb5902",error:"#8f0c3d",info:"#367cff","success-foreground":"#25fc54","warning-foreground":"#ffebc4","error-foreground":"#ffcdd9","info-foreground":"#d5e8ff"};function q(t){if(!t.results)throw new Error("No results found in response for scan summary extraction");let{results:e}=t;return{scanId:e.trackingId,scanDuration:e.scanDuration,pagesScanned:e.pagesScanned.length,totalPages:e.totalPagesFound,detectedItemsCount:e.detectedItems.length,scannedAt:e.scannedAt}}function B(t){let e=M(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function W(t){if(!t.results)throw new Error("No results found in response for actionable items extraction");let{results:e}=t,o=e.detectedItems.filter(r=>r.type==="script").length,s=e.detectedItems.filter(r=>r.type==="cookie").length,n=$(e);return{scripts:o,cookies:s,cmpInstalled:n??void 0}}function Y(t){if(!t.results)throw new Error("No results found in response for violations extraction");return V(t.results)}function X(t){if(!t.results)throw new Error("No results found in response for detected items extraction");let{results:e}=t,o=e.detectedItems.filter(n=>n.type==="script"||n.type==="link"),s=e.detectedItems.filter(n=>n.type==="cookie"||n.type==="local-storage"||n.type==="session-storage");return{dom:o,storage:s}}function Z(t){let e=M(t);return{pass:e.summary.passed,fail:e.summary.failed,warn:e.summary.warnings,unverified:e.summary.notVerifiable}}function K(t){if(!t.results)throw new Error("No results found in response for major violations extraction");return G(t.results)}function Q(t){if(!t.results)throw new Error("No results found in response for statistics extraction");let{results:e}=t;return{scanDuration:he(e.scanDuration),resourcesCount:e.detectedItems.length,firstParty:e.statistics?.firstPartyResources??0,thirdParty:e.statistics?.thirdPartyResources??0,categories:Object.keys(e.statistics?.categoryCounts||{}).length}}function ge(t){return M(t)}function ye(t){return{scanSummary:q(t),compliance:B(t),actionableItems:W(t),violations:Y(t),detectedItems:X(t),complianceSummary:Z(t),majorViolations:K(t),statistics:Q(t)}}function he(t){let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),s=e%60;return`${o}m ${s}s`}var h={extractScanSummary:q,extractCompliance:B,extractActionableItems:W,extractViolations:Y,extractDetectedItems:X,extractComplianceSummary:Z,extractMajorViolations:K,extractStatistics:Q,extractFullCompliance:ge,extractAll:ye};var J="data-fs-cs";var c=(t,e=document)=>e.querySelector(`[${J}="${t}"]`),x=(t,e=document)=>e.querySelectorAll(`[${J}="${t}"]`);var ee={"X-Finsweet-ConsentPro-Version":"v2"},te={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},k=class extends Error{constructor(o,s,n){super(o);H(this,"status");H(this,"response");this.name="ScannerApiError",this.status=s,this.response=n}};async function D(t){if(!t.ok){let e=await t.text().catch(()=>"Unknown error");throw new k(`API request failed: ${t.statusText}`,t.status,e)}return t.json()}var P={async startScan(t){let e=await fetch(`${L}/v2/scanner/public/scan`,{method:"POST",headers:te,body:JSON.stringify({url:t})});if(e.status===409){let s=await e.json(),{trackingId:n}=s;if(n&&typeof n=="string")return s;throw new k("Scan conflict (409) but no trackingId in response",409,s)}return await D(e)},async getStatus(t){let e=await fetch(`${L}/v2/scanner/public/status/${t}`,{headers:ee});return await D(e)},async getResults(t){let e=await fetch(`${L}/v2/scanner/public/results/${t}`,{headers:ee});return await D(e)},async cancelScan(t){let e=await fetch(`${L}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:te});return await D(e)}};var Ee='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>',ke='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',be='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m2 2 20 20"/><path d="M8.35 2.69A10 10 0 0 1 21.3 15.65"/><path d="M19.08 19.08A10 10 0 1 1 4.92 4.92"/></svg>',Ce='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16h.01M12 8v4M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86z"/></svg>',xe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>',Se='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>',we='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',Te='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/></svg>',Ie={"warning-triangle":Ee,"check-circle":ke,"circle-off":be,"alert-octagon":Ce,"chevron-right":xe,"alert-circle":Se,clock:we,"help-circle":Te},Re=(t,e)=>{let o=Ie[t];return e?.color&&(o=o.replace(/currentColor/g,e.color)),e?.size&&(o=o.replace("<svg",`<svg width="${e.size}" height="${e.size}"`)),o},b=(t,e,o)=>{let s=Re(e,o),n=document.createElement("template");n.innerHTML=s.trim();let r=n.content.firstElementChild;if(!r)return null;if(r.setAttribute("data-fs-icon",e),o?.size&&(r.style.setProperty("width",`${o.size}px`,"important"),r.style.setProperty("height",`${o.size}px`,"important")),t.className){let i=r.getAttribute("class")||"";r.setAttribute("class",`${i} ${t.className}`.trim())}return t.replaceWith(r),r};var Le=1e3,A={compliant:"check-circle",notCompliant:"circle-off",warning:"warning-triangle"},oe={pass:{icon:"check-circle",color:f.success,label:"pass"},fail:{icon:"alert-circle",color:f.error,label:"fail"},warning:{icon:"warning-triangle",color:f.warning,label:"warning"},"not-verifiable":{icon:"help-circle",color:f.info,label:"not verifiable"}},ne=t=>t.type==="script"||t.type==="iframe"||t.type==="link"||t.type==="noscript",se=t=>t.type==="cookie"||t.type==="local-storage"||t.type==="session-storage",Ae=()=>{let t=new URLSearchParams(window.location.search),e=t.get("trid"),o=t.get("site");return!e||!o?(console.error("[Results] Missing required query parameters:",{trid:e,site:o}),null):{trackingId:e,site:o}},Me=t=>{let e=c("current-scan-activity");e&&(e.textContent=t)},De=(t,e)=>{let o=c("scan-progress");if(o){let s=e>0?Math.round(t/e*100):0;o.textContent=`${t} / ${e} pages (${s}%)`}},Pe=async t=>new Promise((e,o)=>{let s=setInterval(async()=>{try{let n=await P.getStatus(t);if(n.currentActivity&&Me(n.currentActivity),n.progress){let{pagesScanned:r,totalPages:i}=n.progress;De(r,i)}if(n.status==="completed")clearInterval(s),e();else if(n.status==="failed"){let r=n.error||"Scan failed unexpectedly";console.error("[Results] Scan failed:",r),window.alert(`Scan failed: ${r}`),clearInterval(s),o(new Error(r))}}catch(n){console.error("[Results] Error polling status:",n),window.alert("Unable to check scan status. Please try again."),clearInterval(s),o(n)}},Le)}),He=()=>{let t=c("scan_status-style");t&&t.remove()},ze=async t=>{try{return await P.getResults(t)}catch(e){return e instanceof k?console.error("[Results] API Error:",{message:e.message,status:e.status,response:e.response}):console.error("[Results] Failed to fetch results:",e),null}},Ne=t=>{if(!t.results)return;let{origin:e}=t.results,o=new URL(e).hostname;x("target-website").forEach(r=>{r.textContent=o}),x("target-website-url").forEach(r=>{r instanceof HTMLAnchorElement?r.href=e:r.textContent=e})},$e=t=>{let e=h.extractFullCompliance(t),o=c("compliance-score");if(o){let s=c("value",o);if(s){let n=Math.round(e.overallScore);s.textContent=`${n}%`;let r;n>=80?r=f["success-foreground"]:n>=50?r=f.warning:r=f.error,s.style.color=r}}},_e=(t,e)=>{x("target-website").forEach(n=>{n.textContent=e}),x("target-website-url").forEach(n=>{n instanceof HTMLAnchorElement?n.href=t:n.textContent=t})},Ue=t=>{let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),s=e%60;return`${o}m ${s}s`},Oe=t=>new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=(t,e,o,s)=>{let n=c(t);if(!n)return;let r=c("value",n),i=c("text",n);r&&(r.textContent=e),i&&o&&(i.textContent=o),s&&(n.style.backgroundColor=f[s])},je=t=>{if(!t.results)return;let{scanDuration:e,pagesScanned:o,detectedItems:s,scannedAt:n}=t.results;C("scan-duration-card",Ue(e)),C("pages-scanned-card",o.length.toString()),C("items-detected-card",s.length.toString()),C("scan-date-card",Oe(n))},Fe=t=>{if(!t.results)return;let{detectedItems:e}=t.results,o=e.filter(a=>ne(a)&&a.type==="script"&&a.isThirdParty&&(a.category==="analytics"||a.category==="marketing"||a.category==="advertising"||a.category==="uncategorized")).length,s=e.filter(a=>se(a)&&a.type==="cookie"&&a.category!=="essential"&&a.category!=="necessary").length,r=h.extractComplianceSummary(t).fail,{cmpInstalled:i}=h.extractActionableItems(t);C("scripts-detected-card",o.toString(),void 0,o===0?"success":"error"),C("cookies-detected-card",s.toString(),void 0,s===0?"success":"warning"),C("action-items-card",r.toString(),"Violations",r===0?"success":"info"),Ve(!!i)},Ve=t=>{let e=c("cmp-status-card");if(!e)return;let o=c("icon",e),s=c("text",e),n=t?f["success-foreground"]:f["error-foreground"];o&&b(o,t?A.compliant:A.notCompliant,{color:n,size:24}),s&&(s.textContent=t?"CMP Detected":"CMP Not Found"),e.style.backgroundColor=t?f.success:f.error},Ge=t=>{let e=h.extractFullCompliance(t),o=x("compliance-container");if(o.length===0)return;let s=e.summary.failed,n;s===0?n="compliant":s<=2?n="partial":n="non-compliant";let i={compliant:{label:"Compliant",message:"No pre-consent violations detected. Nice work!",icon:A.compliant,color:f.success,iconColor:f["success-foreground"]},partial:{label:"Partial Compliance",message:"Some issues found, but fixable. Let's get you compliant.",icon:A.warning,color:f.warning,iconColor:f["warning-foreground"]},"non-compliant":{label:"Not Compliant",message:"Major compliance gaps detected. Action needed ASAP.",icon:A.notCompliant,color:f.error,iconColor:f["error-foreground"]}}[n];o.forEach(u=>{u.setAttribute("fs-cloak",""),u.classList.add("hide")});let a=null;o.forEach(u=>{(n==="compliant"&&u.classList.contains("compliant")||n!=="compliant"&&!u.classList.contains("compliant"))&&(a=u)}),a||([a]=o),a.removeAttribute("fs-cloak"),a.classList.remove("hide");let l=c("compliance-status",a);if(l){let u=c("icon",l),m=c("text",l);u&&b(u,i.icon,{color:i.iconColor,size:30}),m&&(m.textContent=i.label)}let p=c("compliance-details",a);p&&(p.textContent=i.message);let g=c("violations-wrapper",a);if(g){let u=c("value",g);u&&(u.textContent=s.toString())}a.style.backgroundColor=i.color},qe=t=>{let e=h.extractFullCompliance(t),o=c("violations-component"),s=c("violations-list"),n=c("violation-template");if(!s||!n)return;let r=e.criteria.filter(l=>l.status==="fail");if(o){let l=c("icon",o);l&&b(l,"alert-octagon",{color:f.error,size:24})}Array.from(s.children).forEach(l=>{l!==n&&l.remove()}),n.style.display="none";let a=c("violations-list-empty");if(r.length===0){a&&(a.removeAttribute("fs-cloak"),a.classList.remove("hide")),s.setAttribute("fs-cloak",""),s.classList.add("hide");return}a&&(a.setAttribute("fs-cloak",""),a.classList.add("hide")),s.removeAttribute("fs-cloak"),s.classList.remove("hide"),r.forEach(l=>{let p=n.cloneNode(!0);p.removeAttribute("data-fs-cs"),p.style.display="";let g=c("icon",p);g&&b(g,"chevron-right",{color:f.error,size:16});let u=c("text",p);u&&(u.textContent=`${l.name}: ${l.details}`),s.appendChild(p)})},Be=t=>{let e=h.extractDetectedItems(t),o=e.dom.filter(m=>ne(m)&&m.type==="script"&&m.isThirdParty&&(m.category==="analytics"||m.category==="marketing"||m.category==="advertising"||m.category==="uncategorized")),s=e.storage.filter(m=>se(m)&&m.type==="cookie"&&m.category!=="essential"&&m.category!=="necessary"),n=c("scripts-component"),r=c("script-list"),i=c("script-item"),a=c("script-list-empty");if(r&&i){if(n){let d=c("scripts-title",n);d&&(d.textContent=`Unblocked Scripts (${o.length})`)}Array.from(r.children).forEach(d=>{d!==i&&d.remove()}),i.style.display="none",o.length===0?(a&&(a.removeAttribute("fs-cloak"),a.classList.remove("hide")),r.setAttribute("fs-cloak",""),r.classList.add("hide")):(a&&(a.setAttribute("fs-cloak",""),a.classList.add("hide")),r.removeAttribute("fs-cloak"),r.classList.remove("hide"),o.forEach(d=>{let y=i.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let S=c("script-title",y),w=c("script-url",y),v=c("script-tag",y);if(S&&(S.textContent=d.domain||"Unknown Script"),w&&(w.textContent=d.source?.slice(0,100)||"N/A"),v){let T=d.category||"uncategorized";v.textContent=T,v.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),v.classList.add(`is-${T}`)}r.appendChild(y)}))}let l=c("cookies-component"),p=c("cookie-list"),g=c("cookie-item"),u=c("cookie-list-empty");if(p&&g){if(l){let d=c("cookies-title",l);d&&(d.textContent=`Unblocked Cookies (${s.length})`)}Array.from(p.children).forEach(d=>{d!==g&&d.remove()}),g.style.display="none",s.length===0?(u&&(u.removeAttribute("fs-cloak"),u.classList.remove("hide")),p.setAttribute("fs-cloak",""),p.classList.add("hide")):(u&&(u.setAttribute("fs-cloak",""),u.classList.add("hide")),p.removeAttribute("fs-cloak"),p.classList.remove("hide"),s.forEach(d=>{let y=g.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let S=c("cookie-name",y),w=c("cookie-url",y),v=c("cookie-tag",y);if(S&&(S.textContent=d.name||"Unknown Cookie"),w&&(w.textContent=d.domain||"N/A"),v){let T=d.category||"uncategorized";v.textContent=T,v.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),v.classList.add(`is-${T}`)}p.appendChild(y)}))}},We=t=>{let e=h.extractMajorViolations(t),o=c("attention-list"),s=c("attention-item"),n=c("attention-list-empty");if(!(!o||!s)){if(s.style.display="none",e.length===0){n&&(n.removeAttribute("fs-cloak"),n.classList.remove("hide")),o.setAttribute("fs-cloak",""),o.classList.add("hide");return}n&&(n.setAttribute("fs-cloak",""),n.classList.add("hide")),o.removeAttribute("fs-cloak"),o.classList.remove("hide"),e.forEach(r=>{let i=s.cloneNode(!0);i.removeAttribute("data-fs-cs"),i.style.display="";let a=c("text",i);a&&(a.textContent=r),o.appendChild(i)})}},Ye=t=>{let e=h.extractComplianceSummary(t),o=c("passed-items");if(o){let i=c("value",o);i&&(i.textContent=e.pass.toString())}let s=c("failed-items");if(s){let i=c("value",s);i&&(i.textContent=e.fail.toString())}let n=c("warning-items");if(n){let i=c("value",n);i&&(i.textContent=e.warn.toString())}let r=c("unverified-items");if(r){let i=c("value",r);i&&(i.textContent=e.unverified.toString())}},Xe=t=>{let e=h.extractFullCompliance(t),o=c("criteria-list"),s=c("criteria-item");if(!o||!s)return;Array.from(o.children).forEach(r=>{r!==s&&r.remove()}),s.style.display="none",e.criteria.forEach(r=>{let i=s.cloneNode(!0);i.removeAttribute("data-fs-cs"),i.style.display="";let a=oe[r.status]||oe["not-verifiable"],l=c("icon",i);l&&b(l,a.icon,{color:a.color,size:24});let p=c("criteria-title",i),g=c("criteria-description",i);p&&(p.textContent=r.name),g&&(g.textContent=r.description);let u=c("criteria-status",i);u&&(u.textContent=a.label);let m=i.querySelector(".result-detect_right img");m&&b(m,"chevron-right",{size:16});let d=c("criteria-answer",i);d&&(d.textContent=r.details||"No additional details available."),o.appendChild(i)})},Ze=t=>{let e=h.extractStatistics(t),o=c("stat-duration");if(o){let a=c("value",o);a&&(a.textContent=e.scanDuration)}let s=c("stat-resources");if(s){let a=c("value",s);a&&(a.textContent=e.resourcesCount.toString())}let n=c("stat-first-party");if(n){let a=c("value",n);a&&(a.textContent=e.firstParty.toString())}let r=c("stat-third-party");if(r){let a=c("value",r);a&&(a.textContent=e.thirdParty.toString())}let i=c("stat-categories");if(i){let a=c("value",i);a&&(a.textContent=e.categories.toString())}},Ke=[{name:"websiteInfo",updater:Ne},{name:"complianceScore",updater:$e,requiredElements:["compliance-score"]},{name:"primaryStats",updater:je},{name:"secondaryStats",updater:Fe},{name:"complianceContainer",updater:Ge,requiredElements:["compliance-container"]},{name:"violationsList",updater:qe,requiredElements:["violations-list"]},{name:"detectedItems",updater:Be},{name:"actionItems",updater:We},{name:"complianceSummary",updater:Ye},{name:"complianceCriteria",updater:Xe,requiredElements:["criteria-list"]},{name:"statistics",updater:Ze}],Qe=t=>{Ke.forEach(({name:e,updater:o,requiredElements:s})=>{try{if(s&&s.find(r=>!c(r)))return;o(t)}catch(n){console.error(`[Results] Error in updater "${e}":`,n)}})},Je=async()=>{let t=Ae();if(!t){console.error("[Results] Cannot fetch results without tracking ID");return}_e(`https://${t.site}`,t.site);try{await Pe(t.trackingId);let e=await ze(t.trackingId);e?(Qe(e),He()):(console.error("[Results] Failed to fetch results"),window.alert("Unable to load scan results. Please try again."))}catch(e){console.error("[Results] Error during scan monitoring:",e),window.alert(e instanceof Error?e.message:"An error occurred while monitoring the scan. Please try again.")}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{Je()});})();
|
|
1
|
+
"use strict";(()=>{var re=Object.defineProperty;var ie=(t,e,o)=>e in t?re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var H=(t,e,o)=>ie(t,typeof e!="symbol"?e+"":e,o);var E=t=>t.type==="script"||t.type==="iframe"||t.type==="link"||t.type==="noscript",R=t=>t.type==="cookie"||t.type==="local-storage"||t.type==="session-storage",ae=[{id:"cookieyes",name:"CookieYes",patterns:{scripts:[/cookieyes\.com/i,/cookie-law-info/i],cookies:[/cookieyes-consent/i,/cky-consent/i,/cookielawinfo/i],dom:[/cky-consent/i,/cookie-law-info/i]}},{id:"termly",name:"Termly",patterns:{scripts:[/termly\.io/i,/termly-embed/i],cookies:[/termly/i],dom:[/termly/i]}},{id:"consentmanager",name:"Consentmanager.net",patterns:{scripts:[/consentmanager\.net/i,/consent-manager/i],cookies:[/consentmanager/i,/cmapi/i],dom:[/consent-manager/i]}},{id:"enzuzo",name:"Enzuzo",patterns:{scripts:[/enzuzo\.com/i],cookies:[/enzuzo/i],dom:[/enzuzo/i]}},{id:"cookiebot",name:"Cookiebot (by Usercentrics)",patterns:{scripts:[/cookiebot\.com/i,/consent\.cookiebot/i],cookies:[/CookieConsent/i,/cookiebot/i],dom:[/CookieConsent/i,/cookiebot/i]}},{id:"iubenda",name:"Iubenda",patterns:{scripts:[/iubenda\.com/i,/iubenda_cs/i],cookies:[/_iub_cs/i,/iubenda/i],dom:[/iubenda/i,/_iub_cs/i]}},{id:"osano",name:"Osano",patterns:{scripts:[/osano\.com/i],cookies:[/osano/i],dom:[/osano/i]}},{id:"usercentrics",name:"Usercentrics",patterns:{scripts:[/usercentrics\.eu/i,/usercentrics\.com/i],cookies:[/usercentrics/i,/uc_user_interaction/i],dom:[/usercentrics/i]}},{id:"cookiescript",name:"CookieScript",patterns:{scripts:[/cookiescript\.com/i,/cookie-script/i],cookies:[/CookieScriptConsent/i],dom:[/cookie-script/i]}},{id:"secureprivacy",name:"Secure Privacy",patterns:{scripts:[/secureprivacy\.ai/i],cookies:[/secureprivacy/i],dom:[/secureprivacy/i]}},{id:"onetrust",name:"OneTrust",patterns:{scripts:[/onetrust\.com/i,/optanon/i],cookies:[/OptanonConsent/i,/OptanonAlertBoxClosed/i],dom:[/onetrust/i,/optanon/i]}},{id:"trustarc",name:"TrustArc",patterns:{scripts:[/trustarc\.com/i,/truste\.com/i],cookies:[/truste/i,/notice_behavior/i],dom:[/truste/i]}},{id:"axeptio",name:"Axeptio",patterns:{scripts:[/axept\.io/i,/static\.axept\.io/i],cookies:[/axeptio_/i,/axeptio/i],dom:[/axeptio/i]}},{id:"complianz",name:"Complianz",patterns:{scripts:[/complianz/i],cookies:[/complianz/i,/cmplz/i],dom:[/complianz/i,/cmplz/i]}},{id:"quantcast",name:"Quantcast",patterns:{scripts:[/quantcast/i,/quantserve/i],cookies:[/quantcast/i,/__qca/i],dom:[/quantcast/i]}},{id:"cookieconsent-termsfeed",name:"Cookie Consent by TermsFeed",patterns:{scripts:[/cookieconsent\.com/i,/termsfeed\.com/i],cookies:[/cc_cookie/i],dom:[/cookieconsent/i]}},{id:"finsweet-fs-cc",name:"Finsweet [fs-cc] Consent",patterns:{scripts:[/@finsweet\/cookie-consent/i,/fs-cc\.js/i],cookies:[/fs-cc/i,/finsweet.*cookie/i],dom:[/fs-cc-(mode|src|category|placeholder)\s*=/i,/(?:^|[^-])fs-cc(?:[^-]|$)/i,/fs-consent-element/i,/fs-consent_banner/i]}},{id:"finsweet-cookie-consent",name:"Finsweet Cookie Consent | Finsweet Consent Pro",patterns:{scripts:[/@finsweet\/fs-components/i,/finsweet.*cookie-consent/i,/fs-cc\.js/i],cookies:[/fs-consent/i,/(?:^|[^-])fs-cc(?:[^-]|$)/i,/(?:^|[^-])fs-consent(?:[^-]|$)/i,/finsweet.*cookie/i],dom:[/fs-components-installed\s*=\s*["']consent["']/i,/(?:^|[^-])fs-cc(?:[^-]|$)/i,/(?:^|[^-])fs-consent(?:[^-]|$)/i,/fs-consent-element/i,/fs-consent_banner/i]}}],_=/youtube\.com|youtu\.be|vimeo\.com|player\.vimeo/i,U=/maps\.google|maps\.googleapis|google\.com\/maps/i,O=/fonts\.googleapis\.com|fonts\.gstatic\.com/i,j=/googletagmanager\.com|gtm\.js/i,ce=/cdn\.intellimize\.co\/snippet\/\d+\.js/i,z=/intellimize/i,I={ga4:{pattern:/gtag|gtm\.js|googletagmanager|analytics\.js|ga\.js/i,name:"Google Analytics",category:"analytics"},gtm:{pattern:/googletagmanager\.com\/gtm\.js/i,name:"Google Tag Manager",category:"analytics"},metaPixel:{pattern:/connect\.facebook\.net|fbevents\.js|fb-pixel/i,name:"Meta Pixel",category:"marketing"},bingUET:{pattern:/bat\.bing\.com/i,name:"Bing UET",category:"marketing"},googleAds:{pattern:/googleadservices\.com|googlesyndication|pagead2/i,name:"Google Ads",category:"marketing"},hotjar:{pattern:/hotjar\.com|static\.hotjar/i,name:"Hotjar",category:"analytics"},clarity:{pattern:/clarity\.ms/i,name:"Microsoft Clarity",category:"analytics"},linkedin:{pattern:/snap\.licdn\.com|linkedin.*insight/i,name:"LinkedIn Insight",category:"marketing"},twitter:{pattern:/static\.ads-twitter\.com/i,name:"Twitter Pixel",category:"marketing"},tiktok:{pattern:/analytics\.tiktok\.com/i,name:"TikTok Pixel",category:"marketing"},pinterest:{pattern:/pintrk|pinterest.*tag/i,name:"Pinterest Tag",category:"marketing"},hubspot:{pattern:/js\.hs-scripts\.com|js\.hubspot\.com/i,name:"HubSpot",category:"marketing"},intercom:{pattern:/widget\.intercom\.io/i,name:"Intercom",category:"marketing"},segment:{pattern:/segment\.com|segment\.io/i,name:"Segment",category:"analytics"},mixpanel:{pattern:/mixpanel\.com/i,name:"Mixpanel",category:"analytics"},amplitude:{pattern:/amplitude\.com/i,name:"Amplitude",category:"analytics"},heap:{pattern:/heap-analytics|heapanalytics/i,name:"Heap Analytics",category:"analytics"},youtube:{pattern:/youtube\.com|youtu\.be/i,name:"YouTube Embed",category:"marketing"},vimeo:{pattern:/vimeo\.com|player\.vimeo/i,name:"Vimeo Embed",category:"marketing"}};function F(t){let e=[];e.push(le(t)),e.push(me(t)),e.push(pe(t)),e.push(N(t)),e.push(ue(t)),e.push({id:"script-head-placement",name:"Script Head Placement",description:"Verify consent script is placed at the top of <head> section",status:"not-verifiable",details:"Cannot be verified from scan results. Manual review required."}),e.push(de(t)),e.push({id:"auto-placeholder",name:"Auto-placeholder Support",description:"Check if blocked videos have placeholder elements",status:"not-verifiable",details:"Cannot be verified from scan results. Manual review required."});let o={passed:e.filter(l=>l.status==="pass").length,failed:e.filter(l=>l.status==="fail").length,warnings:e.filter(l=>l.status==="warning").length,notVerifiable:e.filter(l=>l.status==="not-verifiable").length},s=e.filter(l=>l.status!=="not-verifiable");if(s.length===0)return{overallScore:0,hasViolations:o.failed>0,criteria:e,summary:o};let n=["consent-tool"],r=0,i=0;for(let l of s){let p=n.includes(l.id)?2:1,g=l.status==="pass"?1:l.status==="warning"?.5:0;r+=g*p,i+=p}return{overallScore:Math.round(r/i*100),hasViolations:o.failed>0,criteria:e,summary:o}}function M(t){if(!t.results)throw new Error("No results found in response for compliance evaluation");return F(t.results)}function le(t){let e=t.detectedItems.filter(E).filter(n=>_.test(n.domain)||_.test(n.source)),o=e.map(n=>n.id);if(e.length===0)return{id:"video-embeds",name:"YouTube/Vimeo Detection",description:"Detect YouTube or Vimeo video embeds that may store cookies",status:"pass",details:"No YouTube or Vimeo embeds detected."};let s=e.filter(n=>n.isThirdParty);return{id:"video-embeds",name:"YouTube/Vimeo Detection",description:"Detect YouTube or Vimeo video embeds that may store cookies",status:"fail",details:`Found ${e.length} video embed(s) from YouTube/Vimeo. ${s.length} are third-party resources that may store cookies before consent.`,affectedItems:o}}function me(t){let e=t.detectedItems.filter(E).filter(s=>U.test(s.domain)||U.test(s.source)),o=e.map(s=>s.id);return e.length===0?{id:"google-maps",name:"Google Maps Detection",description:"Detect Google Maps embeds that may store cookies",status:"pass",details:"No Google Maps embeds detected."}:{id:"google-maps",name:"Google Maps Detection",description:"Detect Google Maps embeds that may store cookies",status:"fail",details:`Found ${e.length} Google Maps embed(s) that may store cookies before consent.`,affectedItems:o}}function pe(t){let e=t.detectedItems.filter(E).filter(s=>O.test(s.domain)||O.test(s.source)),o=e.map(s=>s.id);return e.length===0?{id:"google-fonts",name:"Google Fonts Detection",description:"Detect Google Fonts which transfer IP addresses to Google servers without consent",status:"pass",details:"No Google Fonts detected. Website may be using self-hosted fonts."}:{id:"google-fonts",name:"Google Fonts Detection",description:"Detect Google Fonts which transfer IP addresses to Google servers without consent",status:"fail",details:`Found ${e.length} Google Fonts resource(s). This transfers visitor IP addresses to Google without consent, which is a GDPR violation. Fonts should be self-hosted or loaded only after consent.`,affectedItems:o}}function N(t){let e=[],o=new Map;for(let n of ae){let r=0;if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let i of t.detectedItems)if(E(i)&&i.type==="script"){let{source:a}=i,l=i.element?.outerHTML||"";for(let p of n.patterns.scripts)if(p.test(a)||p.test(l)){r+=1,e.includes(i.id)||e.push(i.id);break}}}if(t.trackersInfo?.providers&&Array.isArray(t.trackersInfo.providers))for(let i of t.trackersInfo.providers){let a=i.name||"";for(let l of n.patterns.scripts)if(l.test(a)){r+=1,e.includes(i.id)||e.push(i.id);break}}if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let i of t.detectedItems)if(R(i)&&i.type==="cookie"){let{name:a}=i;for(let l of n.patterns.cookies)if(l.test(a)){r+=1,e.includes(i.id)||e.push(i.id);break}}}if(t.detectedItems&&Array.isArray(t.detectedItems))for(let i of t.detectedItems){let l=E(i)&&i.element?.outerHTML||"";for(let p of n.patterns.dom)if(p.test(l)){r+=1,e.includes(i.id)||e.push(i.id);break}}r>0&&o.set(n.name,r)}let s=Array.from(o.entries()).sort((n,r)=>r[1]-n[1]).map(([n])=>n);return s.length===0?{id:"consent-tool",name:"\u26A0\uFE0F Consent Tool Detection",description:"Check if a cookie consent management tool is installed",status:"fail",details:"No cookie consent tool detected. A consent banner is required for GDPR compliance."}:{id:"consent-tool",name:"Consent Tool Detection",description:"Check if a cookie consent management tool is installed",status:"pass",details:`Detected consent tool(s): ${s.join(", ")}`,affectedItems:e}}function ue(t){let e=t.detectedItems.filter(s=>{if(!E(s)||s.category!=="uncategorized"||!s.isThirdParty)return!1;let n=s.domain??"",r=s.source??"";return!(j.test(n)||j.test(r))}),o=e.map(s=>s.id);return e.length===0?{id:"uncategorized-trackers",name:"Uncategorized Third-Party Trackers",description:"Check for third-party resources without proper categorization",status:"pass",details:"All third-party resources are properly categorized."}:{id:"uncategorized-trackers",name:"Uncategorized Third-Party Trackers",description:"Check for third-party resources without proper categorization",status:"fail",details:`Found ${e.length} uncategorized third-party resource(s). These should be reviewed and categorized for proper consent management.`,affectedItems:o}}function de(t){let e=t.detectedItems??[];if(!e.some(l=>E(l)&&l.type==="script"&&ce.test(l.source)))return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"pass",details:"Webflow Optimize/Analyze (Intellimize) not detected."};if(N(t).status!=="pass")return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"pass",details:"Webflow Optimize detected; no CMP\u2014consent-gating not applicable."};let n=e.filter(l=>R(l)&&l.type==="cookie"&&z.test(l.name)),r=e.filter(l=>R(l)&&l.type==="session-storage"&&z.test(l.name)),i=e.filter(l=>R(l)&&l.type==="local-storage"&&z.test(l.name)),a=[];if(n.length>0&&a.push(`${n.length} cookie(s)`),r.length>0&&a.push(`${r.length} session-storage key(s)`),i.length>0&&a.push(`${i.length} local-storage key(s)`),a.length>0){let l=[...n.map(p=>p.id),...r.map(p=>p.id),...i.map(p=>p.id)];return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"fail",details:`Intellimize cookies/storage present despite CMP: ${a.join(", ")}.`,affectedItems:l}}return{id:"webflow-optimize",name:"Webflow Optimize Detection",description:"Detect Webflow Optimize and Analyze configurations",status:"pass",details:"Webflow Optimize detected; CMP present and no Intellimize cookies or storage detected."}}function $(t){let e=N(t);return e.status!=="pass"||!e.details?null:e.details.match(/Detected consent tool\(s\): (.+)/)?.[1]?.trim()??null}function V(t){return F(t).criteria.filter(o=>o.status==="fail").map(o=>`${o.name}: ${o.details}`)}function G(t){let e=[],o=t.detectedItems??[],s=o.filter(E),n=o.filter(R),r=s.some(m=>m.type==="script"&&m.isThirdParty&&I.ga4.pattern.test(m.source)),i=s.some(m=>m.type==="script"&&m.isThirdParty&&I.metaPixel.pattern.test(m.source)),a=s.some(m=>m.type==="script"&&m.isThirdParty&&I.bingUET.pattern.test(m.source)),l=s.some(m=>m.type==="script"&&m.isThirdParty&&I.hotjar.pattern.test(m.source)),p=s.some(m=>m.type==="script"&&m.isThirdParty&&I.clarity.pattern.test(m.source));r&&e.push("\u{1F534} Google Analytics/GTM is running before user consent"),i&&e.push("\u{1F534} Meta Pixel is firing before user consent"),a&&e.push("\u{1F534} Bing UET tag loads pre-consent"),l&&e.push("\u{1F534} Hotjar is tracking before consent"),p&&e.push("\u{1F534} Microsoft Clarity runs pre-consent");let g=n.filter(m=>m.type==="cookie"&&m.category!=="essential"&&m.category!=="necessary");g.length>0&&e.push(`\u{1F36A} ${g.length} non-essential cookies set before consent`);let u=n.filter(m=>(m.type==="local-storage"||m.type==="session-storage")&&m.category!=="essential"&&m.category!=="necessary");return u.length>0&&e.push(`\u{1F4BE} ${u.length} localStorage/sessionStorage items set pre-consent`),$(t)||e.push("\u26A0\uFE0F No consent management platform detected"),e}var fe=localStorage.getItem("cs-dev")==="true",L=fe?"http://127.0.0.1:8787":"https://fs-consentpro-api-dev.finsweet.workers.dev",ot=1440*60*1e3;var f={success:"#07601d",warning:"#bb5902",error:"#8f0c3d",info:"#367cff","success-foreground":"#25fc54","warning-foreground":"#ffebc4","error-foreground":"#ffcdd9","info-foreground":"#d5e8ff"};function q(t){if(!t.results)throw new Error("No results found in response for scan summary extraction");let{results:e}=t;return{scanId:e.trackingId,scanDuration:e.scanDuration,pagesScanned:e.pagesScanned.length,totalPages:e.totalPagesFound,detectedItemsCount:e.detectedItems.length,scannedAt:e.scannedAt}}function B(t){let e=M(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function W(t){if(!t.results)throw new Error("No results found in response for actionable items extraction");let{results:e}=t,o=e.detectedItems.filter(r=>r.type==="script").length,s=e.detectedItems.filter(r=>r.type==="cookie").length,n=$(e);return{scripts:o,cookies:s,cmpInstalled:n??void 0}}function Y(t){if(!t.results)throw new Error("No results found in response for violations extraction");return V(t.results)}function X(t){if(!t.results)throw new Error("No results found in response for detected items extraction");let{results:e}=t,o=e.detectedItems.filter(n=>n.type==="script"||n.type==="link"),s=e.detectedItems.filter(n=>n.type==="cookie"||n.type==="local-storage"||n.type==="session-storage");return{dom:o,storage:s}}function Z(t){let e=M(t);return{pass:e.summary.passed,fail:e.summary.failed,warn:e.summary.warnings,unverified:e.summary.notVerifiable}}function K(t){if(!t.results)throw new Error("No results found in response for major violations extraction");return G(t.results)}function Q(t){if(!t.results)throw new Error("No results found in response for statistics extraction");let{results:e}=t;return{scanDuration:he(e.scanDuration),resourcesCount:e.detectedItems.length,firstParty:e.statistics?.firstPartyResources??0,thirdParty:e.statistics?.thirdPartyResources??0,categories:Object.keys(e.statistics?.categoryCounts||{}).length}}function ge(t){return M(t)}function ye(t){return{scanSummary:q(t),compliance:B(t),actionableItems:W(t),violations:Y(t),detectedItems:X(t),complianceSummary:Z(t),majorViolations:K(t),statistics:Q(t)}}function he(t){let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),s=e%60;return`${o}m ${s}s`}var h={extractScanSummary:q,extractCompliance:B,extractActionableItems:W,extractViolations:Y,extractDetectedItems:X,extractComplianceSummary:Z,extractMajorViolations:K,extractStatistics:Q,extractFullCompliance:ge,extractAll:ye};var J="data-fs-cs";var c=(t,e=document)=>e.querySelector(`[${J}="${t}"]`),x=(t,e=document)=>e.querySelectorAll(`[${J}="${t}"]`);var ee={"X-Finsweet-ConsentPro-Version":"v2"},te={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},k=class extends Error{constructor(o,s,n){super(o);H(this,"status");H(this,"response");this.name="ScannerApiError",this.status=s,this.response=n}};async function D(t){if(!t.ok){let e=await t.text().catch(()=>"Unknown error");throw new k(`API request failed: ${t.statusText}`,t.status,e)}return t.json()}var P={async startScan(t){let e=await fetch(`${L}/v2/scanner/public/scan`,{method:"POST",headers:te,body:JSON.stringify({url:t})});if(e.status===409){let s=await e.json(),{trackingId:n}=s;if(n&&typeof n=="string")return s;throw new k("Scan conflict (409) but no trackingId in response",409,s)}return await D(e)},async getStatus(t){let e=await fetch(`${L}/v2/scanner/public/status/${t}`,{headers:ee});return await D(e)},async getResults(t){let e=await fetch(`${L}/v2/scanner/public/results/${t}`,{headers:ee});return await D(e)},async cancelScan(t){let e=await fetch(`${L}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:te});return await D(e)}};var Ee='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>',ke='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',be='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m2 2 20 20"/><path d="M8.35 2.69A10 10 0 0 1 21.3 15.65"/><path d="M19.08 19.08A10 10 0 1 1 4.92 4.92"/></svg>',Ce='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 16h.01M12 8v4M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86z"/></svg>',xe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>',Se='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>',we='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',Te='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/></svg>',Ie={"warning-triangle":Ee,"check-circle":ke,"circle-off":be,"alert-octagon":Ce,"chevron-right":xe,"alert-circle":Se,clock:we,"help-circle":Te},Re=(t,e)=>{let o=Ie[t];return e?.color&&(o=o.replace(/currentColor/g,e.color)),e?.size&&(o=o.replace("<svg",`<svg width="${e.size}" height="${e.size}"`)),o},b=(t,e,o)=>{let s=Re(e,o),n=document.createElement("template");n.innerHTML=s.trim();let r=n.content.firstElementChild;if(!r)return null;if(r.setAttribute("data-fs-icon",e),o?.size&&(r.style.setProperty("width",`${o.size}px`,"important"),r.style.setProperty("height",`${o.size}px`,"important")),t.className){let i=r.getAttribute("class")||"";r.setAttribute("class",`${i} ${t.className}`.trim())}return t.replaceWith(r),r};var Le=1e3,A={compliant:"check-circle",notCompliant:"circle-off",warning:"warning-triangle"},oe={pass:{icon:"check-circle",color:f.success,label:"pass"},fail:{icon:"alert-circle",color:f.error,label:"fail"},warning:{icon:"warning-triangle",color:f.warning,label:"warning"},"not-verifiable":{icon:"help-circle",color:f.info,label:"not verifiable"}},ne=t=>t.type==="script"||t.type==="iframe"||t.type==="link"||t.type==="noscript",se=t=>t.type==="cookie"||t.type==="local-storage"||t.type==="session-storage",Ae=()=>{let t=new URLSearchParams(window.location.search),e=t.get("trid"),o=t.get("site");return!e||!o?(console.error("[Results] Missing required query parameters:",{trid:e,site:o}),window.location.assign("/scan"),null):{trackingId:e,site:o}},Me=t=>{let e=c("current-scan-activity");e&&(e.textContent=t)},De=(t,e)=>{let o=c("scan-progress");if(o){let s=e>0?Math.round(t/e*100):0;o.textContent=`${t} / ${e} pages (${s}%)`}},Pe=async t=>new Promise((e,o)=>{let s=setInterval(async()=>{try{let n=await P.getStatus(t);if(n.currentActivity&&Me(n.currentActivity),n.progress){let{pagesScanned:r,totalPages:i}=n.progress;De(r,i)}if(n.status==="completed")clearInterval(s),e();else if(n.status==="failed"){let r=n.error||"Scan failed unexpectedly";console.error("[Results] Scan failed:",r),window.alert(`Scan failed: ${r}`),clearInterval(s),o(new Error(r))}}catch(n){console.error("[Results] Error polling status:",n),window.alert("Unable to check scan status. Please try again."),clearInterval(s),o(n)}},Le)}),He=()=>{let t=c("scan_status-style");t&&t.remove()},ze=async t=>{try{return await P.getResults(t)}catch(e){return e instanceof k?console.error("[Results] API Error:",{message:e.message,status:e.status,response:e.response}):console.error("[Results] Failed to fetch results:",e),null}},Ne=t=>{if(!t.results)return;let{origin:e}=t.results,o=new URL(e).hostname;x("target-website").forEach(r=>{r.textContent=o}),x("target-website-url").forEach(r=>{r instanceof HTMLAnchorElement?r.href=e:r.textContent=e})},$e=t=>{let e=h.extractFullCompliance(t),o=c("compliance-score");if(o){let s=c("value",o);if(s){let n=Math.round(e.overallScore);s.textContent=`${n}%`;let r;n>=80?r=f["success-foreground"]:n>=50?r=f.warning:r=f.error,s.style.color=r}}},_e=(t,e)=>{x("target-website").forEach(n=>{n.textContent=e}),x("target-website-url").forEach(n=>{n instanceof HTMLAnchorElement?n.href=t:n.textContent=t})},Ue=t=>{let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),s=e%60;return`${o}m ${s}s`},Oe=t=>new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=(t,e,o,s)=>{let n=c(t);if(!n)return;let r=c("value",n),i=c("text",n);r&&(r.textContent=e),i&&o&&(i.textContent=o),s&&(n.style.backgroundColor=f[s])},je=t=>{if(!t.results)return;let{scanDuration:e,pagesScanned:o,detectedItems:s,scannedAt:n}=t.results;C("scan-duration-card",Ue(e)),C("pages-scanned-card",o.length.toString()),C("items-detected-card",s.length.toString()),C("scan-date-card",Oe(n))},Fe=t=>{if(!t.results)return;let{detectedItems:e}=t.results,o=e.filter(a=>ne(a)&&a.type==="script"&&a.isThirdParty&&(a.category==="analytics"||a.category==="marketing"||a.category==="advertising"||a.category==="uncategorized")).length,s=e.filter(a=>se(a)&&a.type==="cookie"&&a.category!=="essential"&&a.category!=="necessary").length,r=h.extractComplianceSummary(t).fail,{cmpInstalled:i}=h.extractActionableItems(t);C("scripts-detected-card",o.toString(),void 0,o===0?"success":"error"),C("cookies-detected-card",s.toString(),void 0,s===0?"success":"warning"),C("action-items-card",r.toString(),"Violations",r===0?"success":"info"),Ve(!!i)},Ve=t=>{let e=c("cmp-status-card");if(!e)return;let o=c("icon",e),s=c("text",e),n=t?f["success-foreground"]:f["error-foreground"];o&&b(o,t?A.compliant:A.notCompliant,{color:n,size:24}),s&&(s.textContent=t?"CMP Detected":"CMP Not Found"),e.style.backgroundColor=t?f.success:f.error},Ge=t=>{let e=h.extractFullCompliance(t),o=x("compliance-container");if(o.length===0)return;let s=e.summary.failed,n;s===0?n="compliant":s<=2?n="partial":n="non-compliant";let i={compliant:{label:"Compliant",message:"No pre-consent violations detected. Nice work!",icon:A.compliant,color:f.success,iconColor:f["success-foreground"]},partial:{label:"Partial Compliance",message:"Some issues found, but fixable. Let's get you compliant.",icon:A.warning,color:f.warning,iconColor:f["warning-foreground"]},"non-compliant":{label:"Not Compliant",message:"Major compliance gaps detected. Action needed ASAP.",icon:A.notCompliant,color:f.error,iconColor:f["error-foreground"]}}[n];o.forEach(u=>{u.setAttribute("fs-cloak",""),u.classList.add("hide")});let a=null;o.forEach(u=>{(n==="compliant"&&u.classList.contains("compliant")||n!=="compliant"&&!u.classList.contains("compliant"))&&(a=u)}),a||([a]=o),a.removeAttribute("fs-cloak"),a.classList.remove("hide");let l=c("compliance-status",a);if(l){let u=c("icon",l),m=c("text",l);u&&b(u,i.icon,{color:i.iconColor,size:30}),m&&(m.textContent=i.label)}let p=c("compliance-details",a);p&&(p.textContent=i.message);let g=c("violations-wrapper",a);if(g){let u=c("value",g);u&&(u.textContent=s.toString())}a.style.backgroundColor=i.color},qe=t=>{let e=h.extractFullCompliance(t),o=c("violations-component"),s=c("violations-list"),n=c("violation-template");if(!s||!n)return;let r=e.criteria.filter(l=>l.status==="fail");if(o){let l=c("icon",o);l&&b(l,"alert-octagon",{color:f.error,size:24})}Array.from(s.children).forEach(l=>{l!==n&&l.remove()}),n.style.display="none";let a=c("violations-list-empty");if(r.length===0){a&&(a.removeAttribute("fs-cloak"),a.classList.remove("hide")),s.setAttribute("fs-cloak",""),s.classList.add("hide");return}a&&(a.setAttribute("fs-cloak",""),a.classList.add("hide")),s.removeAttribute("fs-cloak"),s.classList.remove("hide"),r.forEach(l=>{let p=n.cloneNode(!0);p.removeAttribute("data-fs-cs"),p.style.display="";let g=c("icon",p);g&&b(g,"chevron-right",{color:f.error,size:16});let u=c("text",p);u&&(u.textContent=`${l.name}: ${l.details}`),s.appendChild(p)})},Be=t=>{let e=h.extractDetectedItems(t),o=e.dom.filter(m=>ne(m)&&m.type==="script"&&m.isThirdParty&&(m.category==="analytics"||m.category==="marketing"||m.category==="advertising"||m.category==="uncategorized")),s=e.storage.filter(m=>se(m)&&m.type==="cookie"&&m.category!=="essential"&&m.category!=="necessary"),n=c("scripts-component"),r=c("script-list"),i=c("script-item"),a=c("script-list-empty");if(r&&i){if(n){let d=c("scripts-title",n);d&&(d.textContent=`Unblocked Scripts (${o.length})`)}Array.from(r.children).forEach(d=>{d!==i&&d.remove()}),i.style.display="none",o.length===0?(a&&(a.removeAttribute("fs-cloak"),a.classList.remove("hide")),r.setAttribute("fs-cloak",""),r.classList.add("hide")):(a&&(a.setAttribute("fs-cloak",""),a.classList.add("hide")),r.removeAttribute("fs-cloak"),r.classList.remove("hide"),o.forEach(d=>{let y=i.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let S=c("script-title",y),w=c("script-url",y),v=c("script-tag",y);if(S&&(S.textContent=d.domain||"Unknown Script"),w&&(w.textContent=d.source?.slice(0,100)||"N/A"),v){let T=d.category||"uncategorized";v.textContent=T,v.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),v.classList.add(`is-${T}`)}r.appendChild(y)}))}let l=c("cookies-component"),p=c("cookie-list"),g=c("cookie-item"),u=c("cookie-list-empty");if(p&&g){if(l){let d=c("cookies-title",l);d&&(d.textContent=`Unblocked Cookies (${s.length})`)}Array.from(p.children).forEach(d=>{d!==g&&d.remove()}),g.style.display="none",s.length===0?(u&&(u.removeAttribute("fs-cloak"),u.classList.remove("hide")),p.setAttribute("fs-cloak",""),p.classList.add("hide")):(u&&(u.setAttribute("fs-cloak",""),u.classList.add("hide")),p.removeAttribute("fs-cloak"),p.classList.remove("hide"),s.forEach(d=>{let y=g.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let S=c("cookie-name",y),w=c("cookie-url",y),v=c("cookie-tag",y);if(S&&(S.textContent=d.name||"Unknown Cookie"),w&&(w.textContent=d.domain||"N/A"),v){let T=d.category||"uncategorized";v.textContent=T,v.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),v.classList.add(`is-${T}`)}p.appendChild(y)}))}},We=t=>{let e=h.extractMajorViolations(t),o=c("attention-list"),s=c("attention-item"),n=c("attention-list-empty");if(!(!o||!s)){if(s.style.display="none",e.length===0){n&&(n.removeAttribute("fs-cloak"),n.classList.remove("hide")),o.setAttribute("fs-cloak",""),o.classList.add("hide");return}n&&(n.setAttribute("fs-cloak",""),n.classList.add("hide")),o.removeAttribute("fs-cloak"),o.classList.remove("hide"),e.forEach(r=>{let i=s.cloneNode(!0);i.removeAttribute("data-fs-cs"),i.style.display="";let a=c("text",i);a&&(a.textContent=r),o.appendChild(i)})}},Ye=t=>{let e=h.extractComplianceSummary(t),o=c("passed-items");if(o){let i=c("value",o);i&&(i.textContent=e.pass.toString())}let s=c("failed-items");if(s){let i=c("value",s);i&&(i.textContent=e.fail.toString())}let n=c("warning-items");if(n){let i=c("value",n);i&&(i.textContent=e.warn.toString())}let r=c("unverified-items");if(r){let i=c("value",r);i&&(i.textContent=e.unverified.toString())}},Xe=t=>{let e=h.extractFullCompliance(t),o=c("criteria-list"),s=c("criteria-item");if(!o||!s)return;Array.from(o.children).forEach(r=>{r!==s&&r.remove()}),s.style.display="none",e.criteria.forEach(r=>{let i=s.cloneNode(!0);i.removeAttribute("data-fs-cs"),i.style.display="";let a=oe[r.status]||oe["not-verifiable"],l=c("icon",i);l&&b(l,a.icon,{color:a.color,size:24});let p=c("criteria-title",i),g=c("criteria-description",i);p&&(p.textContent=r.name),g&&(g.textContent=r.description);let u=c("criteria-status",i);u&&(u.textContent=a.label);let m=i.querySelector(".result-detect_right img");m&&b(m,"chevron-right",{size:16});let d=c("criteria-answer",i);d&&(d.textContent=r.details||"No additional details available."),o.appendChild(i)})},Ze=t=>{let e=h.extractStatistics(t),o=c("stat-duration");if(o){let a=c("value",o);a&&(a.textContent=e.scanDuration)}let s=c("stat-resources");if(s){let a=c("value",s);a&&(a.textContent=e.resourcesCount.toString())}let n=c("stat-first-party");if(n){let a=c("value",n);a&&(a.textContent=e.firstParty.toString())}let r=c("stat-third-party");if(r){let a=c("value",r);a&&(a.textContent=e.thirdParty.toString())}let i=c("stat-categories");if(i){let a=c("value",i);a&&(a.textContent=e.categories.toString())}},Ke=[{name:"websiteInfo",updater:Ne},{name:"complianceScore",updater:$e,requiredElements:["compliance-score"]},{name:"primaryStats",updater:je},{name:"secondaryStats",updater:Fe},{name:"complianceContainer",updater:Ge,requiredElements:["compliance-container"]},{name:"violationsList",updater:qe,requiredElements:["violations-list"]},{name:"detectedItems",updater:Be},{name:"actionItems",updater:We},{name:"complianceSummary",updater:Ye},{name:"complianceCriteria",updater:Xe,requiredElements:["criteria-list"]},{name:"statistics",updater:Ze}],Qe=t=>{Ke.forEach(({name:e,updater:o,requiredElements:s})=>{try{if(s&&s.find(r=>!c(r)))return;o(t)}catch(n){console.error(`[Results] Error in updater "${e}":`,n)}})},Je=async()=>{let t=Ae();if(!t){console.error("[Results] Cannot fetch results without tracking ID");return}_e(`https://${t.site}`,t.site);try{await Pe(t.trackingId);let e=await ze(t.trackingId);e?(Qe(e),He()):(console.error("[Results] Failed to fetch results"),window.alert("Unable to load scan results. Please try again."))}catch(e){console.error("[Results] Error during scan monitoring:",e),window.alert(e instanceof Error?e.message:"An error occurred while monitoring the scan. Please try again.")}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{Je()});})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finsweet/consentpro-scan",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A frontend scanner for ConsentPro, a cookie consent management platform by Finsweet.",
|
|
5
5
|
"homepage": "https://github.com/finsweet/consentpro-scan#readme",
|
|
6
6
|
"license": "ISC",
|
|
@@ -22,18 +22,6 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"dev": "cross-env NODE_ENV=development node ./bin/build.js",
|
|
27
|
-
"build": "cross-env NODE_ENV=production node ./bin/build.js",
|
|
28
|
-
"lint": "eslint ./src && prettier --check ./src",
|
|
29
|
-
"lint:fix": "eslint ./src --fix",
|
|
30
|
-
"check": "tsc --noEmit",
|
|
31
|
-
"format": "prettier --write ./src",
|
|
32
|
-
"test": "playwright test",
|
|
33
|
-
"test:ui": "playwright test --ui",
|
|
34
|
-
"release": "changeset publish",
|
|
35
|
-
"update": "pnpm update -i -L -r"
|
|
36
|
-
},
|
|
37
25
|
"devDependencies": {
|
|
38
26
|
"@changesets/changelog-git": "^0.2.0",
|
|
39
27
|
"@changesets/cli": "^2.27.12",
|
|
@@ -57,16 +45,16 @@
|
|
|
57
45
|
"engines": {
|
|
58
46
|
"pnpm": ">=10"
|
|
59
47
|
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
"scripts": {
|
|
49
|
+
"dev": "cross-env NODE_ENV=development node ./bin/build.js",
|
|
50
|
+
"build": "cross-env NODE_ENV=production node ./bin/build.js",
|
|
51
|
+
"lint": "eslint ./src && prettier --check ./src",
|
|
52
|
+
"lint:fix": "eslint ./src --fix",
|
|
53
|
+
"check": "tsc --noEmit",
|
|
54
|
+
"format": "prettier --write ./src",
|
|
55
|
+
"test": "playwright test",
|
|
56
|
+
"test:ui": "playwright test --ui",
|
|
57
|
+
"release": "changeset publish",
|
|
58
|
+
"update": "pnpm update -i -L -r"
|
|
71
59
|
}
|
|
72
|
-
}
|
|
60
|
+
}
|