@finsweet/consentpro-scan 1.0.7 → 1.0.8

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 (2) hide show
  1. package/dist/results.js +1 -1
  2. package/package.json +1 -1
package/dist/results.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var he=Object.defineProperty;var ke=(t,e,o)=>e in t?he(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var F=(t,e,o)=>ke(t,typeof e!="symbol"?e+"":e,o);var G=(t=document)=>t.documentElement.getAttribute("data-wf-site");var j=async t=>{let{Webflow:e}=window;if(!(!e||!("destroy"in e)||!("ready"in e)||!("require"in e))&&!(t&&!t.length)){if(t||(e.destroy(),e.ready()),!t||t.includes("ix2")){let o=e.require("ix2");if(o){let{store:n,actions:s}=o,{eventState:r}=n.getState().ixSession,a=Object.entries(r);t||o.destroy(),o.init(),await Promise.all(a.map(c=>n.dispatch(s.eventStateChanged(...c))))}}if(!t||t.includes("commerce")){let o=e.require("commerce"),n=G();o&&n&&(o.destroy(),o.init({siteId:n,apiUrl:"https://render.webflow.com"}))}if(t?.includes("lightbox")&&e.require("lightbox")?.ready(),t?.includes("slider")){let o=e.require("slider");o&&(o.redraw(),o.ready())}return t?.includes("tabs")&&e.require("tabs")?.redraw(),new Promise(o=>e.push(()=>o(void 0)))}};var k=t=>t.type==="script"||t.type==="iframe"||t.type==="link"||t.type==="noscript",x=t=>t.type==="cookie"||t.type==="local-storage"||t.type==="session-storage",ve=t=>t.type==="banner",be=["essential","necessary"],C=t=>!!t&&be.includes(t),A=t=>t.filter(k),V=t=>t.filter(e=>e.type==="script"),xe=t=>t.filter(e=>e.type==="iframe"),Ee=t=>t.filter(e=>e.type==="link"),Ce=t=>t.filter(e=>e.type==="noscript"),Se=t=>t.filter(e=>k(e)&&e.isThirdParty&&!C(e.category)),we=t=>t.filter(e=>e.type==="script"&&e.isThirdParty&&!C(e.category)),D=t=>t.filter(x),q=t=>t.filter(e=>e.type==="cookie"),Ie=t=>t.filter(e=>e.type==="local-storage"),Te=t=>t.filter(e=>e.type==="session-storage"),Re=t=>t.filter(e=>x(e)&&!C(e.category)),N=t=>t.filter(e=>e.type==="cookie"&&!C(e.category)),B=t=>t.filter(e=>e.type==="local-storage"&&!C(e.category)),W=t=>t.filter(e=>e.type==="session-storage"&&!C(e.category)),$=t=>t.filter(e=>e.type==="cookie"&&(!e.category||e.category==="uncategorized")),M={isEssentialCategory:C,isResourceItem:k,isStorageItem:x,isBannerItem:ve,domResources:A,scripts:V,iframes:xe,links:Ee,noscripts:Ce,unblockedDOMResources:Se,unblockedScripts:we,storageResources:D,cookies:q,localStorage:Ie,sessionStorage:Te,unblockedStorageResources:Re,unblockedCookies:N,unblockedLocalStorage:B,unblockedSessionStorage:W,uncategorizedCookies:$};var Le=[{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]}}],Q=/youtube\.com|youtu\.be|vimeo\.com|player\.vimeo/i,J=/maps\.google|maps\.googleapis|google\.com\/maps/i,ee=/fonts\.googleapis\.com|fonts\.gstatic\.com/i,te=/googletagmanager\.com|gtm\.js/i,Ae=/cdn\.intellimize\.co\/snippet\/\d+\.js/i,Y=/intellimize/i,H={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 oe(t){let e=[];e.push(De(t)),e.push(Me(t)),e.push(He(t)),e.push(X(t)),e.push(Pe(t)),e.push(ze(t)),e.push(Ne(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($e(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},n=e.filter(l=>l.status!=="not-verifiable");if(n.length===0)return{overallScore:0,hasViolations:o.failed>0,criteria:e,summary:o};let s=["consent-tool"],r=0,a=0;for(let l of n){let m=s.includes(l.id)?2:1,f=l.status==="pass"?1:l.status==="warning"?.5:0;r+=f*m,a+=m}return{overallScore:Math.round(r/a*100),hasViolations:o.failed>0,criteria:e,summary:o}}function U(t){if(!t.results)throw new Error("No results found in response for compliance evaluation");return oe(t.results)}function De(t){let e=t.detectedItems.filter(k).filter(s=>Q.test(s.domain)||Q.test(s.source)),o=e.map(s=>s.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 n=e.filter(s=>s.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. ${n.length} are third-party resources that may store cookies before consent.`,affectedItems:o}}function Me(t){let e=t.detectedItems.filter(k).filter(n=>J.test(n.domain)||J.test(n.source)),o=e.map(n=>n.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 He(t){let e=t.detectedItems.filter(k).filter(n=>ee.test(n.domain)||ee.test(n.source)),o=e.map(n=>n.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 X(t){let e=[],o=new Map;for(let s of Le){let r=0;if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let a of t.detectedItems)if(k(a)&&a.type==="script"){let{source:c}=a,l=a.element?.outerHTML||"";for(let m of s.patterns.scripts)if(m.test(c)||m.test(l)){r+=1,e.includes(a.id)||e.push(a.id);break}}}if(t.trackersInfo?.providers&&Array.isArray(t.trackersInfo.providers))for(let a of t.trackersInfo.providers){let c=a.name||"";for(let l of s.patterns.scripts)if(l.test(c)){r+=1,e.includes(a.id)||e.push(a.id);break}}if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let a of t.detectedItems)if(x(a)&&a.type==="cookie"){let{name:c}=a;for(let l of s.patterns.cookies)if(l.test(c)){r+=1,e.includes(a.id)||e.push(a.id);break}}}if(t.detectedItems&&Array.isArray(t.detectedItems))for(let a of t.detectedItems){let l=k(a)&&a.element?.outerHTML||"";for(let m of s.patterns.dom)if(m.test(l)){r+=1,e.includes(a.id)||e.push(a.id);break}}r>0&&o.set(s.name,r)}let n=Array.from(o.entries()).sort((s,r)=>r[1]-s[1]).map(([s])=>s);return n.length===0?{id:"consent-tool",name:"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): ${n.join(", ")}`,affectedItems:e}}function Pe(t){let e=t.detectedItems.filter(n=>{if(!k(n)||n.category!=="uncategorized"||!n.isThirdParty)return!1;let s=n.domain??"",r=n.source??"";return!(te.test(s)||te.test(r))}),o=e.map(n=>n.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 ze(t){let e=N(t.detectedItems),o=e.map(s=>s.id);return e.length===0?{id:"non-essential-cookies",name:"Non-Essential Cookies",description:"Check for non-essential cookies set before consent",status:"pass",details:"No non-essential cookies detected before consent."}:{id:"non-essential-cookies",name:"Non-Essential Cookies",description:"Check for non-essential cookies set before consent",status:e.length>5?"fail":"warning",details:`Found ${e.length} non-essential cookie(s) being set before consent. These should be blocked until user provides consent.`,affectedItems:o}}function Ne(t){let e=$(t.detectedItems),o=e.map(n=>n.id);return e.length===0?{id:"uncategorized-cookies",name:"Uncategorized Cookies",description:"Check for cookies without proper categorization",status:"pass",details:"All cookies are properly categorized."}:{id:"uncategorized-cookies",name:"Uncategorized Cookies",description:"Check for cookies without proper categorization",status:"fail",details:`Found ${e.length} uncategorized cookie(s). These should be reviewed and assigned to appropriate consent categories.`,affectedItems:o}}function $e(t){let e=t.detectedItems??[];if(!e.some(l=>k(l)&&l.type==="script"&&Ae.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(X(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 s=e.filter(l=>x(l)&&l.type==="cookie"&&Y.test(l.name)),r=e.filter(l=>x(l)&&l.type==="session-storage"&&Y.test(l.name)),a=e.filter(l=>x(l)&&l.type==="local-storage"&&Y.test(l.name)),c=[];if(s.length>0&&c.push(`${s.length} cookie(s)`),r.length>0&&c.push(`${r.length} session-storage key(s)`),a.length>0&&c.push(`${a.length} local-storage key(s)`),c.length>0){let l=[...s.map(m=>m.id),...r.map(m=>m.id),...a.map(m=>m.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: ${c.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 Z(t){let e=X(t);return e.status!=="pass"||!e.details?null:e.details.match(/Detected consent tool\(s\): (.+)/)?.[1]?.trim()??null}function ne(t){return oe(t).criteria.filter(o=>o.status==="fail").map(o=>`${o.name}: ${o.details}`)}function se(t){let e=[],o=t.detectedItems??[],n=A(o),s=D(o),r=n.some(d=>d.type==="script"&&d.isThirdParty&&H.ga4.pattern.test(d.source)),a=n.some(d=>d.type==="script"&&d.isThirdParty&&H.metaPixel.pattern.test(d.source)),c=n.some(d=>d.type==="script"&&d.isThirdParty&&H.bingUET.pattern.test(d.source)),l=n.some(d=>d.type==="script"&&d.isThirdParty&&H.hotjar.pattern.test(d.source)),m=n.some(d=>d.type==="script"&&d.isThirdParty&&H.clarity.pattern.test(d.source));r&&e.push("Google Analytics/GTM is running before user consent"),a&&e.push("Meta Pixel is firing before user consent"),c&&e.push("Bing UET tag loads pre-consent"),l&&e.push("Hotjar is tracking before consent"),m&&e.push("Microsoft Clarity runs pre-consent");let f=N(s);f.length>0&&e.push(`${f.length} non-essential cookies set before consent`);let p=$(s);p.length>0&&e.push(`${p.length} uncategorized cookies detected - review and categorize`);let h=B(s),u=W(s),y=h.length+u.length;return y>0&&e.push(`${y} localStorage/sessionStorage items set pre-consent`),Z(t)||e.push("No consent management platform detected"),e}var Ue=localStorage.getItem("cs-dev")==="true",P=Ue?"https://parallel-queue-processing-fs-consentpro-api-dev.finsweet.workers.dev":"https://fs-consentpro-api-dev.finsweet.workers.dev",Ot=1440*60*1e3;var g={success:"#07601d",warning:"#bb5902",error:"#8F0C3D",info:"#598FFF","success-foreground":"#25fc54","warning-foreground":"#FFAA00","error-foreground":"#FF265A","info-foreground":"#d5e8ff"};function re(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 ie(t){let e=U(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function ae(t){if(!t.results)throw new Error("No results found in response for actionable items extraction");let{results:e}=t,o=V(e.detectedItems).length,n=q(e.detectedItems).length,s=Z(e);return{scripts:o,cookies:n,cmpInstalled:s??void 0}}function ce(t){if(!t.results)throw new Error("No results found in response for violations extraction");return ne(t.results)}function le(t){if(!t.results)throw new Error("No results found in response for detected items extraction");let{results:e}=t,o=A(e.detectedItems),n=D(e.detectedItems);return{dom:o,storage:n}}function me(t){let e=U(t);return{pass:e.summary.passed,fail:e.summary.failed,warn:e.summary.warnings,unverified:e.summary.notVerifiable}}function pe(t){if(!t.results)throw new Error("No results found in response for attention items extraction");return se(t.results)}function ue(t){if(!t.results)throw new Error("No results found in response for statistics extraction");let{results:e}=t;return{scanDuration:Fe(e.scanDuration),resourcesCount:e.detectedItems.length,firstParty:e.statistics?.firstPartyResources??0,thirdParty:e.statistics?.thirdPartyResources??0,categories:Object.keys(e.statistics?.categoryCounts||{}).length}}function Oe(t){return U(t)}function _e(t){return{scanSummary:re(t),compliance:ie(t),actionableItems:ae(t),violations:ce(t),detectedItems:le(t),complianceSummary:me(t),attentionItems:pe(t),statistics:ue(t)}}function Fe(t){let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),n=e%60;return`${o}m ${n}s`}var v={extractScanSummary:re,extractCompliance:ie,extractActionableItems:ae,extractViolations:ce,extractDetectedItems:le,extractComplianceSummary:me,extractAttentionItems:pe,extractStatistics:ue,extractFullCompliance:Oe,extractAll:_e};var de="data-fs-cs";var i=(t,e=document)=>e.querySelector(`[${de}="${t}"]`),w=(t,e=document)=>e.querySelectorAll(`[${de}="${t}"]`);var fe={"X-Finsweet-ConsentPro-Version":"v2"},ge={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},E=class extends Error{constructor(o,n,s){super(o);F(this,"status");F(this,"response");this.name="ScannerApiError",this.status=n,this.response=s}};async function O(t){if(!t.ok){let e=t.statusText,o;try{let n=await t.json();o=n,n&&typeof n.error=="string"&&(e=n.error)}catch{o=await t.text().catch(()=>"Unknown error")}throw new E(`Report request failed: ${e}`,t.status,o)}return t.json()}var _={async startScan(t){let e=await fetch(`${P}/v2/scanner/public/scan`,{method:"POST",headers:ge,body:JSON.stringify({url:t})});if(e.status===409){let n=await e.json().catch(()=>({}));throw new E("A scan is already in progress for this website. Please wait for it to complete.",409,n)}if(e.status!==201){let n=await e.text().catch(()=>"Unknown error");throw new E(`Expected 201 Created but got ${e.status}`,e.status,n)}return await O(e)},async getStatus(t){let e=await fetch(`${P}/v2/scanner/public/status/${t}`,{headers:fe});return await O(e)},async getResults(t){let e=await fetch(`${P}/v2/scanner/public/results/${t}`,{headers:fe});return await O(e)},async cancelScan(t){let e=await fetch(`${P}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:ge});return await O(e)}};var je='<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>',Ve='<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>',qe='<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>',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="M12 16h.01M12 8v4M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86z"/></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"><path d="m9 18 6-6-6-6"/></svg>',Ye='<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>',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"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',Ze='<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>',Ke={"warning-triangle":je,"check-circle":Ve,"circle-off":qe,"alert-octagon":Be,"chevron-right":We,"alert-circle":Ye,clock:Xe,"help-circle":Ze},Qe=(t,e)=>{let o=Ke[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},I=(t,e,o)=>{let n=Qe(e,o),s=document.createElement("template");s.innerHTML=n.trim();let r=s.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 a=r.getAttribute("class")||"";r.setAttribute("class",`${a} ${t.className}`.trim())}return t.replaceWith(r),r};var Je=1e3,z={compliant:"check-circle",notCompliant:"circle-off",warning:"warning-triangle"},ye={pass:{icon:"check-circle",color:g["success-foreground"],label:"pass"},fail:{icon:"alert-circle",color:g["error-foreground"],label:"fail"},warning:{icon:"warning-triangle",color:g["warning-foreground"],label:"warning"},"not-verifiable":{icon:"help-circle",color:g.info,label:"not verifiable"}},et=()=>{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}},tt=t=>{let e=i("current-scan-activity");e&&(e.textContent=t,console.log(`[Results] Current scan activity: ${t}`))},ot=(t,e)=>{let o=i("scan-progress");if(o){let n=e>0?Math.round(t/e*100):0;o.textContent=`${t} / ${e} pages (${n}%)`,console.log(`[Results] Scan progress: ${t} / ${e} pages (${n}%)`)}},nt=()=>{let t=i("scan-progress-container"),e=i("scan-error-container");t&&(t.style.display="flex"),e&&(e.style.display="none")},K=t=>{let e=i("scan-progress-container"),o=i("scan-error-container"),n=i("current-scan-error");e&&(e.style.display="none"),o&&(o.style.display="flex"),n&&(n.innerHTML=t)},st=async t=>(nt(),new Promise((e,o)=>{let n=setInterval(async()=>{try{let s=await _.getStatus(t);if(console.log("[Results] Polled scan status:",s),s.currentActivity&&tt(s.currentActivity),s.progress){let{pagesScanned:r,totalPages:a}=s.progress;ot(r,a)}if(s.status==="completed")clearInterval(n),e();else if(s.status==="failed"){let r=s.error||"Scan failed unexpectedly";console.error("[Results] Scan failed:",r),K(`Scan failed: ${r}`),clearInterval(n),o(new Error(r))}}catch(s){console.error("[Results] Error polling status:",s),K("Unable to check scan status. Please try again."),clearInterval(n),o(s)}},Je)})),rt=()=>{let t=i("scan-status_style");t&&t.remove()},it=async t=>_.getResults(t),at=t=>{if(!t.results)return;let{origin:e}=t.results,o=new URL(e).hostname;w("target-website").forEach(r=>{r.textContent=o}),w("target-website-url").forEach(r=>{r instanceof HTMLAnchorElement?r.href=e:r.textContent=e})},ct=t=>{let e=v.extractFullCompliance(t),o=i("compliance-score");if(o){let n=i("value",o);if(n){let s=Math.round(e.overallScore);n.textContent=`${s}%`;let r;s>=80?r=g["success-foreground"]:s>=50?r=g["warning-foreground"]:r=g["error-foreground"],n.style.color=r}}},lt=(t,e)=>{w("target-website").forEach(s=>{s.textContent=e}),w("target-website-url").forEach(s=>{s instanceof HTMLAnchorElement?s.href=t:s.textContent=t})},mt=t=>{let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),n=e%60;return`${o}m ${n}s`},pt=t=>new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),S=(t,e,o,n)=>{let s=i(t);if(!s)return;let r=i("value",s),a=i("text",s);r&&(r.textContent=e),a&&o&&(a.textContent=o),n&&(s.style.backgroundColor=g[n])},ut=t=>{if(!t.results)return;let{scanDuration:e,pagesScanned:o,detectedItems:n,scannedAt:s}=t.results;S("scan-duration-card",mt(e)),S("pages-scanned-card",o.length.toString()),S("items-detected-card",n.length.toString()),S("scan-date-card",pt(s))},dt=t=>{if(!t.results)return;let{detectedItems:e}=t.results,o=M.unblockedScripts(e).length,n=M.unblockedCookies(e).length,r=v.extractComplianceSummary(t).fail,{cmpInstalled:a}=v.extractActionableItems(t);S("scripts-detected-card",o.toString(),void 0,o===0?"success":"error"),S("cookies-detected-card",n.toString(),void 0,n===0?"success":"warning"),S("action-items-card",r.toString(),"Violations",r===0?"success":"info"),ft(!!a)},ft=t=>{let e=i("cmp-status-card");if(!e)return;let o=i("icon",e),n=i("text",e),s=t?g["success-foreground"]:g["error-foreground"];o&&I(o,t?z.compliant:z.notCompliant,{color:s,size:24}),n&&(n.textContent=t?"CMP Detected":"CMP Not Found"),e.style.backgroundColor=t?g.success:g.error},gt=t=>{let e=v.extractFullCompliance(t),o=w("compliance-container");if(o.length===0)return;let n=e.summary.failed,s;n===0?s="compliant":n<=2?s="partial":s="non-compliant";let a={compliant:{label:"Compliant",message:"No pre-consent violations detected. Nice work!",icon:z.compliant,color:g.success,iconColor:g["success-foreground"]},partial:{label:"Partial Compliance",message:"Some issues found, but fixable. Let's get you compliant.",icon:z.warning,color:g.warning,iconColor:g["warning-foreground"]},"non-compliant":{label:"Not Compliant",message:"Major compliance gaps detected. Action needed ASAP.",icon:z.notCompliant,color:g.error,iconColor:g["error-foreground"]}}[s];o.forEach(p=>{p.setAttribute("fs-cloak",""),p.classList.add("hide")});let c=null;o.forEach(p=>{(s==="compliant"&&p.classList.contains("compliant")||s!=="compliant"&&!p.classList.contains("compliant"))&&(c=p)}),c||([c]=o),c.removeAttribute("fs-cloak"),c.classList.remove("hide");let l=i("compliance-status",c);if(l){let p=i("icon",l),h=i("text",l);p&&I(p,a.icon,{color:a.iconColor,size:30}),h&&(h.textContent=a.label)}let m=i("compliance-details",c);m&&(m.textContent=a.message);let f=i("violations-wrapper",c);if(f){let p=i("value",f);p&&(p.textContent=n.toString())}c.style.backgroundColor=a.color},yt=t=>{let e=v.extractFullCompliance(t),o=i("violations-component"),n=i("violations-list"),s=i("violation-template");if(!n||!s)return;let r=e.criteria.filter(m=>m.status==="fail");if(o){let m=i("icon",o);m&&I(m,"alert-octagon",{color:g["error-foreground"],size:24})}Array.from(n.children).forEach(m=>{m!==s&&m.remove()}),s.style.display="none";let c=i("violations-list-empty");if(r.length===0){c&&(c.removeAttribute("fs-cloak"),c.classList.remove("hide")),n.setAttribute("fs-cloak",""),n.classList.add("hide");return}c&&(c.setAttribute("fs-cloak",""),c.classList.add("hide")),n.removeAttribute("fs-cloak"),n.classList.remove("hide");let l={"non-essential-cookies":"\u{1F36A}","uncategorized-cookies":"\u{1F534}","uncategorized-trackers":"\u{1F534}","consent-tool":"\u26A0\uFE0F","video-embeds":"\u{1F534}","google-maps":"\u{1F534}","google-fonts":"\u{1F534}","webflow-optimize":"\u{1F534}"};r.forEach(m=>{let f=s.cloneNode(!0);f.removeAttribute("data-fs-cs"),f.style.display="";let p=i("icon",f);p&&I(p,"chevron-right",{color:g["error-foreground"],size:16});let h=i("text",f);if(h){let u=l[m.id]??"\u{1F534}";h.textContent=`${u} ${m.name}: ${m.details}`}n.appendChild(f)})},ht=t=>{let e=v.extractDetectedItems(t),o=M.unblockedDOMResources(e.dom),n=M.unblockedStorageResources(e.storage),s=i("scripts-component"),r=i("script-list"),a=i("script-item"),c=i("script-list-empty");if(r&&a){if(s){let u=i("scripts-title",s);u&&(u.textContent=`Unblocked Resources (${o.length})`)}Array.from(r.children).forEach(u=>{u!==a&&u.remove()}),a.style.display="none",o.length===0?(c&&(c.removeAttribute("fs-cloak"),c.classList.remove("hide")),r.setAttribute("fs-cloak",""),r.classList.add("hide")):(c&&(c.setAttribute("fs-cloak",""),c.classList.add("hide")),r.removeAttribute("fs-cloak"),r.classList.remove("hide"),o.forEach(u=>{let y=a.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let d=i("script-title",y),T=i("script-url",y),R=i("script-type",y),b=i("script-tag",y);if(d&&(d.textContent=u.domain||`Unknown ${u.type}`),T&&(T.textContent=u.source?.slice(0,100)||"N/A"),R&&(R.textContent=u.type||"N/A"),b){let L=u.category||"uncategorized";b.textContent=L,b.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),b.classList.add(`is-${L}`)}r.appendChild(y)}))}let l=i("cookies-component"),m=i("cookie-list"),f=i("cookie-item"),p=i("cookie-list-empty");if(m&&f){if(l){let u=i("cookies-title",l);u&&(u.textContent=`Unblocked Cookies + Storage (${n.length})`)}Array.from(m.children).forEach(u=>{u!==f&&u.remove()}),f.style.display="none",n.length===0?(p&&(p.removeAttribute("fs-cloak"),p.classList.remove("hide")),m.setAttribute("fs-cloak",""),m.classList.add("hide")):(p&&(p.setAttribute("fs-cloak",""),p.classList.add("hide")),m.removeAttribute("fs-cloak"),m.classList.remove("hide"),n.forEach(u=>{let y=f.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let d=i("cookie-name",y),T=i("cookie-url",y),R=i("cookie-type",y),b=i("cookie-tag",y);if(d&&(d.textContent=u.name||`Unknown ${u.type}`),T&&(T.textContent=u.domain||"N/A"),R&&(R.textContent=u.type||"N/A"),b){let L=u.category||"uncategorized";b.textContent=L,b.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),b.classList.add(`is-${L}`)}m.appendChild(y)}))}},kt=t=>{let e=v.extractAttentionItems(t),o=i("attention-list"),n=i("attention-item"),s=i("attention-list-empty");if(!(!o||!n)){if(n.style.display="none",e.length===0){s&&(s.removeAttribute("fs-cloak"),s.classList.remove("hide")),o.setAttribute("fs-cloak",""),o.classList.add("hide");return}s&&(s.setAttribute("fs-cloak",""),s.classList.add("hide")),o.removeAttribute("fs-cloak"),o.classList.remove("hide"),e.forEach((r,a)=>{let c=n.cloneNode(!0);c.removeAttribute("data-fs-cs"),c.style.display="";let l=i("value",c);l&&(l.textContent=(a+1).toString());let m=i("text",c);m&&(m.textContent=r),o.appendChild(c)})}},vt=t=>{let e=v.extractComplianceSummary(t),o=i("passed-items");if(o){let a=i("value",o);a&&(a.textContent=e.pass.toString())}let n=i("failed-items");if(n){let a=i("value",n);a&&(a.textContent=e.fail.toString())}let s=i("warning-items");if(s){let a=i("value",s);a&&(a.textContent=e.warn.toString())}let r=i("unverified-items");if(r){let a=i("value",r);a&&(a.textContent=e.unverified.toString())}},bt=t=>{let e=v.extractFullCompliance(t),o=i("criteria-list"),n=i("criteria-item");if(!o||!n)return;Array.from(o.children).forEach(r=>{r!==n&&r.remove()}),n.style.display="none",e.criteria.forEach(r=>{let a=n.cloneNode(!0);a.removeAttribute("data-fs-cs"),a.style.display="";let c=ye[r.status]||ye["not-verifiable"],l=i("icon",a);l&&I(l,c.icon,{color:c.color,size:24});let m=i("criteria-title",a),f=i("criteria-description",a);m&&(m.textContent=r.name),f&&(f.textContent=r.description);let p=i("criteria-status",a);p&&(p.textContent=c.label);let h=i("criteria-answer",a);h&&(h.textContent=r.details||"No additional details available."),o.appendChild(a)})},xt=t=>{let e=v.extractStatistics(t),o=i("stat-duration");if(o){let c=i("value",o);c&&(c.textContent=e.scanDuration)}let n=i("stat-resources");if(n){let c=i("value",n);c&&(c.textContent=e.resourcesCount.toString())}let s=i("stat-first-party");if(s){let c=i("value",s);c&&(c.textContent=e.firstParty.toString())}let r=i("stat-third-party");if(r){let c=i("value",r);c&&(c.textContent=e.thirdParty.toString())}let a=i("stat-categories");if(a){let c=i("value",a);c&&(c.textContent=e.categories.toString())}},Et=[{name:"websiteInfo",updater:at},{name:"complianceScore",updater:ct,requiredElements:["compliance-score"]},{name:"primaryStats",updater:ut},{name:"secondaryStats",updater:dt},{name:"complianceContainer",updater:gt,requiredElements:["compliance-container"]},{name:"violationsList",updater:yt,requiredElements:["violations-list"]},{name:"detectedItems",updater:ht},{name:"attentionItems",updater:kt},{name:"complianceSummary",updater:vt},{name:"complianceCriteria",updater:bt,requiredElements:["criteria-list"]},{name:"statistics",updater:xt}],Ct=t=>{Et.forEach(({name:e,updater:o,requiredElements:n})=>{try{if(n&&n.find(r=>!i(r)))return;o(t)}catch(s){console.error(`[Results] Error in updater "${e}":`,s)}}),j()},St=async()=>{let t=et();if(!t){console.error("[Results] Cannot fetch results without tracking ID");return}lt(`https://${t.site}`,t.site);try{await st(t.trackingId);let e=await it(t.trackingId);console.log("[Results] Fetched results:",e),Ct(e),rt()}catch(e){console.error("[Results] Error during scan:",e);let o="An error occurred. Please try again.";e instanceof E&&e.response&&typeof e.response=="object"&&"error"in e.response?o=e.response.error:e instanceof Error&&(o=e.message),K(o)}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{St()});})();
1
+ "use strict";(()=>{var he=Object.defineProperty;var ke=(t,e,o)=>e in t?he(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var F=(t,e,o)=>ke(t,typeof e!="symbol"?e+"":e,o);var G=(t=document)=>t.documentElement.getAttribute("data-wf-site");var j=async t=>{let{Webflow:e}=window;if(!(!e||!("destroy"in e)||!("ready"in e)||!("require"in e))&&!(t&&!t.length)){if(t||(e.destroy(),e.ready()),!t||t.includes("ix2")){let o=e.require("ix2");if(o){let{store:n,actions:s}=o,{eventState:r}=n.getState().ixSession,a=Object.entries(r);t||o.destroy(),o.init(),await Promise.all(a.map(c=>n.dispatch(s.eventStateChanged(...c))))}}if(!t||t.includes("commerce")){let o=e.require("commerce"),n=G();o&&n&&(o.destroy(),o.init({siteId:n,apiUrl:"https://render.webflow.com"}))}if(t?.includes("lightbox")&&e.require("lightbox")?.ready(),t?.includes("slider")){let o=e.require("slider");o&&(o.redraw(),o.ready())}return t?.includes("tabs")&&e.require("tabs")?.redraw(),new Promise(o=>e.push(()=>o(void 0)))}};var k=t=>t.type==="script"||t.type==="iframe"||t.type==="link"||t.type==="noscript",b=t=>t.type==="cookie"||t.type==="local-storage"||t.type==="session-storage",ve=t=>t.type==="banner",Ce=["essential","necessary"],E=t=>!!t&&Ce.includes(t),A=t=>t.filter(k),V=t=>t.filter(e=>e.type==="script"),be=t=>t.filter(e=>e.type==="iframe"),xe=t=>t.filter(e=>e.type==="link"),Ee=t=>t.filter(e=>e.type==="noscript"),Se=t=>t.filter(e=>k(e)&&e.isThirdParty&&!E(e.category)),we=t=>t.filter(e=>e.type==="script"&&e.isThirdParty&&!E(e.category)),D=t=>t.filter(b),q=t=>t.filter(e=>e.type==="cookie"),Ie=t=>t.filter(e=>e.type==="local-storage"),Te=t=>t.filter(e=>e.type==="session-storage"),Re=t=>t.filter(e=>b(e)&&!E(e.category)),N=t=>t.filter(e=>e.type==="cookie"&&!E(e.category)),B=t=>t.filter(e=>e.type==="local-storage"&&!E(e.category)),W=t=>t.filter(e=>e.type==="session-storage"&&!E(e.category)),$=t=>t.filter(e=>e.type==="cookie"&&(!e.category||e.category==="uncategorized")),M={isEssentialCategory:E,isResourceItem:k,isStorageItem:b,isBannerItem:ve,domResources:A,scripts:V,iframes:be,links:xe,noscripts:Ee,unblockedDOMResources:Se,unblockedScripts:we,storageResources:D,cookies:q,localStorage:Ie,sessionStorage:Te,unblockedStorageResources:Re,unblockedCookies:N,unblockedLocalStorage:B,unblockedSessionStorage:W,uncategorizedCookies:$};var Le=[{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]}}],Q=/youtube\.com|youtu\.be|vimeo\.com|player\.vimeo/i,J=/maps\.google|maps\.googleapis|google\.com\/maps/i,ee=/fonts\.googleapis\.com|fonts\.gstatic\.com/i,te=/googletagmanager\.com|gtm\.js/i,Ae=/cdn\.intellimize\.co\/snippet\/\d+\.js/i,Y=/intellimize/i,H={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 oe(t){let e=[];e.push(De(t)),e.push(Me(t)),e.push(He(t)),e.push(Z(t)),e.push(Pe(t)),e.push(ze(t)),e.push(Ne(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($e(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},n=e.filter(l=>l.status!=="not-verifiable");if(n.length===0)return{overallScore:0,hasViolations:o.failed>0,criteria:e,summary:o};let s=["consent-tool"],r=0,a=0;for(let l of n){let m=s.includes(l.id)?2:1,f=l.status==="pass"?1:l.status==="warning"?.5:0;r+=f*m,a+=m}return{overallScore:Math.round(r/a*100),hasViolations:o.failed>0,criteria:e,summary:o}}function U(t){if(!t.results)throw new Error("No results found in response for compliance evaluation");return oe(t.results)}function De(t){let e=t.detectedItems.filter(k).filter(s=>Q.test(s.domain)||Q.test(s.source)),o=e.map(s=>s.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 n=e.filter(s=>s.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. ${n.length} are third-party resources that may store cookies before consent.`,affectedItems:o}}function Me(t){let e=t.detectedItems.filter(k).filter(n=>J.test(n.domain)||J.test(n.source)),o=e.map(n=>n.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 He(t){let e=t.detectedItems.filter(k).filter(n=>ee.test(n.domain)||ee.test(n.source)),o=e.map(n=>n.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 Z(t){let e=[],o=new Map;for(let s of Le){let r=0;if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let a of t.detectedItems)if(k(a)&&a.type==="script"){let{source:c}=a,l=a.element?.outerHTML||"";for(let m of s.patterns.scripts)if(m.test(c)||m.test(l)){r+=1,e.includes(a.id)||e.push(a.id);break}}}if(t.trackersInfo?.providers&&Array.isArray(t.trackersInfo.providers))for(let a of t.trackersInfo.providers){let c=a.name||"";for(let l of s.patterns.scripts)if(l.test(c)){r+=1,e.includes(a.id)||e.push(a.id);break}}if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let a of t.detectedItems)if(b(a)&&a.type==="cookie"){let{name:c}=a;for(let l of s.patterns.cookies)if(l.test(c)){r+=1,e.includes(a.id)||e.push(a.id);break}}}if(t.detectedItems&&Array.isArray(t.detectedItems))for(let a of t.detectedItems){let l=k(a)&&a.element?.outerHTML||"";for(let m of s.patterns.dom)if(m.test(l)){r+=1,e.includes(a.id)||e.push(a.id);break}}r>0&&o.set(s.name,r)}let n=Array.from(o.entries()).sort((s,r)=>r[1]-s[1]).map(([s])=>s);return n.length===0?{id:"consent-tool",name:"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): ${n.join(", ")}`,affectedItems:e}}function Pe(t){let e=t.detectedItems.filter(n=>{if(!k(n)||n.category!=="uncategorized"||!n.isThirdParty)return!1;let s=n.domain??"",r=n.source??"";return!(te.test(s)||te.test(r))}),o=e.map(n=>n.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 ze(t){let e=N(t.detectedItems),o=e.map(s=>s.id);return e.length===0?{id:"non-essential-cookies",name:"Non-Essential Cookies",description:"Check for non-essential cookies set before consent",status:"pass",details:"No non-essential cookies detected before consent."}:{id:"non-essential-cookies",name:"Non-Essential Cookies",description:"Check for non-essential cookies set before consent",status:e.length>5?"fail":"warning",details:`Found ${e.length} non-essential cookie(s) being set before consent. These should be blocked until user provides consent.`,affectedItems:o}}function Ne(t){let e=$(t.detectedItems),o=e.map(n=>n.id);return e.length===0?{id:"uncategorized-cookies",name:"Uncategorized Cookies",description:"Check for cookies without proper categorization",status:"pass",details:"All cookies are properly categorized."}:{id:"uncategorized-cookies",name:"Uncategorized Cookies",description:"Check for cookies without proper categorization",status:"fail",details:`Found ${e.length} uncategorized cookie(s). These should be reviewed and assigned to appropriate consent categories.`,affectedItems:o}}function $e(t){let e=t.detectedItems??[];if(!e.some(l=>k(l)&&l.type==="script"&&Ae.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(Z(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 s=e.filter(l=>b(l)&&l.type==="cookie"&&Y.test(l.name)),r=e.filter(l=>b(l)&&l.type==="session-storage"&&Y.test(l.name)),a=e.filter(l=>b(l)&&l.type==="local-storage"&&Y.test(l.name)),c=[];if(s.length>0&&c.push(`${s.length} cookie(s)`),r.length>0&&c.push(`${r.length} session-storage key(s)`),a.length>0&&c.push(`${a.length} local-storage key(s)`),c.length>0){let l=[...s.map(m=>m.id),...r.map(m=>m.id),...a.map(m=>m.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: ${c.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 X(t){let e=Z(t);return e.status!=="pass"||!e.details?null:e.details.match(/Detected consent tool\(s\): (.+)/)?.[1]?.trim()??null}function ne(t){return oe(t).criteria.filter(o=>o.status==="fail").map(o=>`${o.name}: ${o.details}`)}function se(t){let e=[],o=t.detectedItems??[],n=A(o),s=D(o),r=n.some(d=>d.type==="script"&&d.isThirdParty&&H.ga4.pattern.test(d.source)),a=n.some(d=>d.type==="script"&&d.isThirdParty&&H.metaPixel.pattern.test(d.source)),c=n.some(d=>d.type==="script"&&d.isThirdParty&&H.bingUET.pattern.test(d.source)),l=n.some(d=>d.type==="script"&&d.isThirdParty&&H.hotjar.pattern.test(d.source)),m=n.some(d=>d.type==="script"&&d.isThirdParty&&H.clarity.pattern.test(d.source));r&&e.push("Google Analytics/GTM is running before user consent"),a&&e.push("Meta Pixel is firing before user consent"),c&&e.push("Bing UET tag loads pre-consent"),l&&e.push("Hotjar is tracking before consent"),m&&e.push("Microsoft Clarity runs pre-consent");let f=N(s);f.length>0&&e.push(`${f.length} non-essential cookies set before consent`);let p=$(s);p.length>0&&e.push(`${p.length} uncategorized cookies detected - review and categorize`);let h=B(s),u=W(s),y=h.length+u.length;return y>0&&e.push(`${y} localStorage/sessionStorage items set pre-consent`),X(t)||e.push("No consent management platform detected"),e}var Ue=localStorage.getItem("cs-dev")==="true",P=Ue?"https://parallel-queue-processing-fs-consentpro-api-dev.finsweet.workers.dev":"https://fs-consentpro-api-dev.finsweet.workers.dev",_t=1440*60*1e3;var g={success:"#07601d",warning:"#bb5902",error:"#8F0C3D",info:"#598FFF","success-foreground":"#25fc54","warning-foreground":"#FFAA00","error-foreground":"#FF265A","info-foreground":"#d5e8ff"};function re(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 ie(t){let e=U(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function ae(t){if(!t.results)throw new Error("No results found in response for actionable items extraction");let{results:e}=t,o=V(e.detectedItems).length,n=q(e.detectedItems).length,s=X(e);return{scripts:o,cookies:n,cmpInstalled:s??void 0}}function ce(t){if(!t.results)throw new Error("No results found in response for violations extraction");return ne(t.results)}function le(t){if(!t.results)throw new Error("No results found in response for detected items extraction");let{results:e}=t,o=A(e.detectedItems),n=D(e.detectedItems);return{dom:o,storage:n}}function me(t){let e=U(t);return{pass:e.summary.passed,fail:e.summary.failed,warn:e.summary.warnings,unverified:e.summary.notVerifiable}}function pe(t){if(!t.results)throw new Error("No results found in response for attention items extraction");return se(t.results)}function ue(t){if(!t.results)throw new Error("No results found in response for statistics extraction");let{results:e}=t;return{scanDuration:Fe(e.scanDuration),resourcesCount:e.detectedItems.length,firstParty:e.statistics?.firstPartyResources??0,thirdParty:e.statistics?.thirdPartyResources??0,categories:Object.keys(e.statistics?.categoryCounts||{}).length}}function Oe(t){return U(t)}function _e(t){return{scanSummary:re(t),compliance:ie(t),actionableItems:ae(t),violations:ce(t),detectedItems:le(t),complianceSummary:me(t),attentionItems:pe(t),statistics:ue(t)}}function Fe(t){let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),n=e%60;return`${o}m ${n}s`}var v={extractScanSummary:re,extractCompliance:ie,extractActionableItems:ae,extractViolations:ce,extractDetectedItems:le,extractComplianceSummary:me,extractAttentionItems:pe,extractStatistics:ue,extractFullCompliance:Oe,extractAll:_e};var de="data-fs-cs";var i=(t,e=document)=>e.querySelector(`[${de}="${t}"]`),w=(t,e=document)=>e.querySelectorAll(`[${de}="${t}"]`);var fe={"X-Finsweet-ConsentPro-Version":"v2"},ge={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},x=class extends Error{constructor(o,n,s){super(o);F(this,"status");F(this,"response");this.name="ScannerApiError",this.status=n,this.response=s}};async function O(t){if(!t.ok){let e=t.statusText,o;try{let n=await t.json();o=n,n&&typeof n.error=="string"&&(e=n.error)}catch{o=await t.text().catch(()=>"Unknown error")}throw new x(`Report request failed: ${e}`,t.status,o)}return t.json()}var _={async startScan(t){let e=await fetch(`${P}/v2/scanner/public/scan`,{method:"POST",headers:ge,body:JSON.stringify({url:t})});if(e.status===409){let n=await e.json().catch(()=>({}));throw new x("A scan is already in progress for this website. Please wait for it to complete.",409,n)}if(e.status!==201){let n=await e.text().catch(()=>"Unknown error");throw new x(`Expected 201 Created but got ${e.status}`,e.status,n)}return await O(e)},async getStatus(t){let e=await fetch(`${P}/v2/scanner/public/status/${t}`,{headers:fe});return await O(e)},async getResults(t){let e=await fetch(`${P}/v2/scanner/public/results/${t}`,{headers:fe});return await O(e)},async cancelScan(t){let e=await fetch(`${P}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:ge});return await O(e)}};var je='<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>',Ve='<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>',qe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" fill="currentColor"><path d="M11 0C17.0751 0 22 4.92487 22 11C22 17.0751 17.0751 22 11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0ZM11 2C6.02944 2 2 6.02944 2 11C2 15.9706 6.02944 20 11 20C15.9706 20 20 15.9706 20 11C20 6.02944 15.9706 2 11 2ZM13.293 7.29297C13.6835 6.90244 14.3165 6.90244 14.707 7.29297C15.0975 7.6835 15.0975 8.31653 14.707 8.70703L12.4141 11L14.707 13.293C15.0975 13.6835 15.0975 14.3165 14.707 14.707C14.3165 15.0975 13.6835 15.0975 13.293 14.707L11 12.4141L8.70703 14.707C8.31653 15.0975 7.6835 15.0975 7.29297 14.707C6.90244 14.3165 6.90244 13.6835 7.29297 13.293L9.58594 11L7.29297 8.70703C6.90244 8.31651 6.90244 7.68349 7.29297 7.29297C7.68349 6.90244 8.31651 6.90244 8.70703 7.29297L11 9.58594L13.293 7.29297Z"/></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>',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"><path d="M12 16h.01M12 8v4M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86z"/></svg>',Ye='<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>',Ze='<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>',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"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></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.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/></svg>',Qe={"warning-triangle":je,"check-circle":Ve,"close-circle":qe,"circle-off":Be,"alert-octagon":We,"chevron-right":Ye,"alert-circle":Ze,clock:Xe,"help-circle":Ke},Je=(t,e)=>{let o=Qe[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},I=(t,e,o)=>{let n=Je(e,o),s=document.createElement("template");s.innerHTML=n.trim();let r=s.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 a=r.getAttribute("class")||"";r.setAttribute("class",`${a} ${t.className}`.trim())}return t.replaceWith(r),r};var et=1e3,z={compliant:"check-circle",notCompliant:"close-circle",warning:"warning-triangle"},ye={pass:{icon:"check-circle",color:g["success-foreground"],label:"pass"},fail:{icon:"alert-circle",color:g["error-foreground"],label:"fail"},warning:{icon:"warning-triangle",color:g["warning-foreground"],label:"warning"},"not-verifiable":{icon:"help-circle",color:g.info,label:"not verifiable"}},tt=()=>{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}},ot=t=>{let e=i("current-scan-activity");e&&(e.textContent=t,console.log(`[Results] Current scan activity: ${t}`))},nt=(t,e)=>{let o=i("scan-progress");if(o){let n=e>0?Math.round(t/e*100):0;o.textContent=`${t} / ${e} pages (${n}%)`,console.log(`[Results] Scan progress: ${t} / ${e} pages (${n}%)`)}},st=()=>{let t=i("scan-progress-container"),e=i("scan-error-container");t&&(t.style.display="flex"),e&&(e.style.display="none")},K=t=>{let e=i("scan-progress-container"),o=i("scan-error-container"),n=i("current-scan-error");e&&(e.style.display="none"),o&&(o.style.display="flex"),n&&(n.innerHTML=t)},rt=async t=>(st(),new Promise((e,o)=>{let n=setInterval(async()=>{try{let s=await _.getStatus(t);if(console.log("[Results] Polled scan status:",s),s.currentActivity&&ot(s.currentActivity),s.progress){let{pagesScanned:r,totalPages:a}=s.progress;nt(r,a)}if(s.status==="completed")clearInterval(n),e();else if(s.status==="failed"){let r=s.error||"Scan failed unexpectedly";console.error("[Results] Scan failed:",r),K(`Scan failed: ${r}`),clearInterval(n),o(new Error(r))}}catch(s){console.error("[Results] Error polling status:",s),K("Unable to check scan status. Please try again."),clearInterval(n),o(s)}},et)})),it=()=>{let t=i("scan-status_style");t&&t.remove()},at=async t=>_.getResults(t),ct=t=>{if(!t.results)return;let{origin:e}=t.results,o=new URL(e).hostname;w("target-website").forEach(r=>{r.textContent=o}),w("target-website-url").forEach(r=>{r instanceof HTMLAnchorElement?r.href=e:r.textContent=e})},lt=t=>{let e=v.extractFullCompliance(t),o=i("compliance-score");if(o){let n=i("value",o);if(n){let s=Math.round(e.overallScore);n.textContent=`${s}%`;let r;s>=80?r=g["success-foreground"]:s>=50?r=g["warning-foreground"]:r=g["error-foreground"],n.style.color=r}}},mt=(t,e)=>{w("target-website").forEach(s=>{s.textContent=e}),w("target-website-url").forEach(s=>{s instanceof HTMLAnchorElement?s.href=t:s.textContent=t})},pt=t=>{let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let o=Math.floor(e/60),n=e%60;return`${o}m ${n}s`},ut=t=>new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),S=(t,e,o,n)=>{let s=i(t);if(!s)return;let r=i("value",s),a=i("text",s);r&&(r.textContent=e),a&&o&&(a.textContent=o),n&&(s.style.backgroundColor=g[n])},dt=t=>{if(!t.results)return;let{scanDuration:e,pagesScanned:o,detectedItems:n,scannedAt:s}=t.results;S("scan-duration-card",pt(e)),S("pages-scanned-card",o.length.toString()),S("items-detected-card",n.length.toString()),S("scan-date-card",ut(s))},ft=t=>{if(!t.results)return;let{detectedItems:e}=t.results,o=M.unblockedScripts(e).length,n=M.unblockedCookies(e).length,r=v.extractComplianceSummary(t).fail,{cmpInstalled:a}=v.extractActionableItems(t);S("scripts-detected-card",o.toString(),void 0,o===0?"success":"error"),S("cookies-detected-card",n.toString(),void 0,n===0?"success":"warning"),S("action-items-card",r.toString(),"Violations",r===0?"success":"info"),gt(!!a)},gt=t=>{let e=i("cmp-status-card");if(!e)return;let o=i("icon",e),n=i("text",e),s=t?g["success-foreground"]:g["error-foreground"];o&&I(o,t?z.compliant:z.notCompliant,{color:s,size:24}),n&&(n.textContent=t?"CMP Detected":"CMP Not Found"),e.style.backgroundColor=t?g.success:g.error},yt=t=>{let e=v.extractFullCompliance(t),o=w("compliance-container");if(o.length===0)return;let n=e.summary.failed,s;n===0?s="compliant":n<=2?s="partial":s="non-compliant";let a={compliant:{label:"Compliant",message:"No pre-consent violations detected. Nice work!",icon:z.compliant,color:g.success,iconColor:g["success-foreground"]},partial:{label:"Partial Compliance",message:"Some issues found, but fixable. Let's get you compliant.",icon:z.warning,color:g.warning,iconColor:g["warning-foreground"]},"non-compliant":{label:"Not Compliant",message:"Major compliance gaps detected. Action needed ASAP.",icon:z.notCompliant,color:g.error,iconColor:g["error-foreground"]}}[s];o.forEach(p=>{p.setAttribute("fs-cloak",""),p.classList.add("hide")});let c=null;o.forEach(p=>{(s==="compliant"&&p.classList.contains("compliant")||s!=="compliant"&&!p.classList.contains("compliant"))&&(c=p)}),c||([c]=o),c.removeAttribute("fs-cloak"),c.classList.remove("hide");let l=i("compliance-status",c);if(l){let p=i("icon",l),h=i("text",l);p&&I(p,a.icon,{color:a.iconColor,size:30}),h&&(h.textContent=a.label)}let m=i("compliance-details",c);m&&(m.textContent=a.message);let f=i("violations-wrapper",c);if(f){let p=i("value",f);p&&(p.textContent=n.toString())}c.style.backgroundColor=a.color},ht=t=>{let e=v.extractFullCompliance(t),o=i("violations-component"),n=i("violations-list"),s=i("violation-template");if(!n||!s)return;let r=e.criteria.filter(m=>m.status==="fail");if(o){let m=i("icon",o);m&&I(m,"alert-octagon",{color:g["error-foreground"],size:24})}Array.from(n.children).forEach(m=>{m!==s&&m.remove()}),s.style.display="none";let c=i("violations-list-empty");if(r.length===0){c&&(c.removeAttribute("fs-cloak"),c.classList.remove("hide")),n.setAttribute("fs-cloak",""),n.classList.add("hide");return}c&&(c.setAttribute("fs-cloak",""),c.classList.add("hide")),n.removeAttribute("fs-cloak"),n.classList.remove("hide");let l={"non-essential-cookies":"\u{1F36A}","uncategorized-cookies":"\u{1F534}","uncategorized-trackers":"\u{1F534}","consent-tool":"\u26A0\uFE0F","video-embeds":"\u{1F534}","google-maps":"\u{1F534}","google-fonts":"\u{1F534}","webflow-optimize":"\u{1F534}"};r.forEach(m=>{let f=s.cloneNode(!0);f.removeAttribute("data-fs-cs"),f.style.display="";let p=i("icon",f);p&&I(p,"chevron-right",{color:g["error-foreground"],size:16});let h=i("text",f);if(h){let u=l[m.id]??"\u{1F534}";h.textContent=`${u} ${m.name}: ${m.details}`}n.appendChild(f)})},kt=t=>{let e=v.extractDetectedItems(t),o=M.unblockedDOMResources(e.dom),n=M.unblockedStorageResources(e.storage),s=i("scripts-component"),r=i("script-list"),a=i("script-item"),c=i("script-list-empty");if(r&&a){if(s){let u=i("scripts-title",s);u&&(u.textContent=`Unblocked Resources (${o.length})`)}Array.from(r.children).forEach(u=>{u!==a&&u.remove()}),a.style.display="none",o.length===0?(c&&(c.removeAttribute("fs-cloak"),c.classList.remove("hide")),r.setAttribute("fs-cloak",""),r.classList.add("hide")):(c&&(c.setAttribute("fs-cloak",""),c.classList.add("hide")),r.removeAttribute("fs-cloak"),r.classList.remove("hide"),o.forEach(u=>{let y=a.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let d=i("script-title",y),T=i("script-url",y),R=i("script-type",y),C=i("script-tag",y);if(d&&(d.textContent=u.domain||`Unknown ${u.type}`),T&&(T.textContent=u.source?.slice(0,100)||"N/A"),R&&(R.textContent=u.type||"N/A"),C){let L=u.category||"uncategorized";C.textContent=L,C.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),C.classList.add(`is-${L}`)}r.appendChild(y)}))}let l=i("cookies-component"),m=i("cookie-list"),f=i("cookie-item"),p=i("cookie-list-empty");if(m&&f){if(l){let u=i("cookies-title",l);u&&(u.textContent=`Unblocked Cookies + Storage (${n.length})`)}Array.from(m.children).forEach(u=>{u!==f&&u.remove()}),f.style.display="none",n.length===0?(p&&(p.removeAttribute("fs-cloak"),p.classList.remove("hide")),m.setAttribute("fs-cloak",""),m.classList.add("hide")):(p&&(p.setAttribute("fs-cloak",""),p.classList.add("hide")),m.removeAttribute("fs-cloak"),m.classList.remove("hide"),n.forEach(u=>{let y=f.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let d=i("cookie-name",y),T=i("cookie-url",y),R=i("cookie-type",y),C=i("cookie-tag",y);if(d&&(d.textContent=u.name||`Unknown ${u.type}`),T&&(T.textContent=u.domain||"N/A"),R&&(R.textContent=u.type||"N/A"),C){let L=u.category||"uncategorized";C.textContent=L,C.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),C.classList.add(`is-${L}`)}m.appendChild(y)}))}},vt=t=>{let e=v.extractAttentionItems(t),o=i("attention-list"),n=i("attention-item"),s=i("attention-list-empty");if(!(!o||!n)){if(n.style.display="none",e.length===0){s&&(s.removeAttribute("fs-cloak"),s.classList.remove("hide")),o.setAttribute("fs-cloak",""),o.classList.add("hide");return}s&&(s.setAttribute("fs-cloak",""),s.classList.add("hide")),o.removeAttribute("fs-cloak"),o.classList.remove("hide"),e.forEach((r,a)=>{let c=n.cloneNode(!0);c.removeAttribute("data-fs-cs"),c.style.display="";let l=i("value",c);l&&(l.textContent=(a+1).toString());let m=i("text",c);m&&(m.textContent=r),o.appendChild(c)})}},Ct=t=>{let e=v.extractComplianceSummary(t),o=i("passed-items");if(o){let a=i("value",o);a&&(a.textContent=e.pass.toString())}let n=i("failed-items");if(n){let a=i("value",n);a&&(a.textContent=e.fail.toString())}let s=i("warning-items");if(s){let a=i("value",s);a&&(a.textContent=e.warn.toString())}let r=i("unverified-items");if(r){let a=i("value",r);a&&(a.textContent=e.unverified.toString())}},bt=t=>{let e=v.extractFullCompliance(t),o=i("criteria-list"),n=i("criteria-item");if(!o||!n)return;Array.from(o.children).forEach(r=>{r!==n&&r.remove()}),n.style.display="none",e.criteria.forEach(r=>{let a=n.cloneNode(!0);a.removeAttribute("data-fs-cs"),a.style.display="";let c=ye[r.status]||ye["not-verifiable"],l=i("icon",a);l&&I(l,c.icon,{color:c.color,size:24});let m=i("criteria-title",a),f=i("criteria-description",a);m&&(m.textContent=r.name),f&&(f.textContent=r.description);let p=i("criteria-status",a);p&&(p.textContent=c.label);let h=i("criteria-answer",a);h&&(h.textContent=r.details||"No additional details available."),o.appendChild(a)})},xt=t=>{let e=v.extractStatistics(t),o=i("stat-duration");if(o){let c=i("value",o);c&&(c.textContent=e.scanDuration)}let n=i("stat-resources");if(n){let c=i("value",n);c&&(c.textContent=e.resourcesCount.toString())}let s=i("stat-first-party");if(s){let c=i("value",s);c&&(c.textContent=e.firstParty.toString())}let r=i("stat-third-party");if(r){let c=i("value",r);c&&(c.textContent=e.thirdParty.toString())}let a=i("stat-categories");if(a){let c=i("value",a);c&&(c.textContent=e.categories.toString())}},Et=[{name:"websiteInfo",updater:ct},{name:"complianceScore",updater:lt,requiredElements:["compliance-score"]},{name:"primaryStats",updater:dt},{name:"secondaryStats",updater:ft},{name:"complianceContainer",updater:yt,requiredElements:["compliance-container"]},{name:"violationsList",updater:ht,requiredElements:["violations-list"]},{name:"detectedItems",updater:kt},{name:"attentionItems",updater:vt},{name:"complianceSummary",updater:Ct},{name:"complianceCriteria",updater:bt,requiredElements:["criteria-list"]},{name:"statistics",updater:xt}],St=t=>{Et.forEach(({name:e,updater:o,requiredElements:n})=>{try{if(n&&n.find(r=>!i(r)))return;o(t)}catch(s){console.error(`[Results] Error in updater "${e}":`,s)}}),j()},wt=async()=>{let t=tt();if(!t){console.error("[Results] Cannot fetch results without tracking ID");return}mt(`https://${t.site}`,t.site);try{await rt(t.trackingId);let e=await at(t.trackingId);console.log("[Results] Fetched results:",e),St(e),it()}catch(e){console.error("[Results] Error during scan:",e);let o="An error occurred. Please try again.";e instanceof x&&e.response&&typeof e.response=="object"&&"error"in e.response?o=e.response.error:e instanceof Error&&(o=e.message),K(o)}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{wt()});})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finsweet/consentpro-scan",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
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",