@finsweet/consentpro-scan 1.0.13 → 1.0.14

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Consent Scan
2
2
 
3
- Frontend client for the ConsentPro scanner API. Provides URL validation, scan initiation, and results display for GDPR/CCPA compliance scanning.
3
+ Frontend client for the ConsentPro scanner API. Provides URL validation, scan initiation, and results display for data privacy compliance scanning (GDPR, CCPA, HIPAA, and other regulations).
4
4
 
5
5
  ## Overview
6
6
 
package/dist/results.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var ke=Object.defineProperty;var Ce=(t,e,o)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var G=(t,e,o)=>Ce(t,typeof e!="symbol"?e+"":e,o);var j=(t=document)=>t.documentElement.getAttribute("data-wf-site");var V=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=j();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",xe=["essential","necessary"],E=t=>!!t&&xe.includes(t),be=/googletagmanager\.com\/gtm\.js\?(?:[^"'#\s]*&)?id=(GTM-[A-Z0-9]+)/gi,A=t=>t.type!=="script"?!1:be.test(t.source),D=t=>t.filter(k),q=t=>t.filter(e=>e.type==="script"),Ee=t=>t.filter(e=>e.type==="iframe"),Se=t=>t.filter(e=>e.type==="link"),we=t=>t.filter(e=>e.type==="noscript"),Ie=t=>t.filter(e=>k(e)&&e.isThirdParty&&!E(e.category)&&!A(e)),Te=t=>t.filter(e=>e.type==="script"&&e.isThirdParty&&!E(e.category)&&!A(e)),M=t=>t.filter(x),B=t=>t.filter(e=>e.type==="cookie"),Re=t=>t.filter(e=>e.type==="local-storage"),Le=t=>t.filter(e=>e.type==="session-storage"),Ae=t=>t.filter(e=>x(e)&&!E(e.category)),$=t=>t.filter(e=>e.type==="cookie"&&!E(e.category)),W=t=>t.filter(e=>e.type==="local-storage"&&!E(e.category)),Y=t=>t.filter(e=>e.type==="session-storage"&&!E(e.category)),U=t=>t.filter(e=>e.type==="cookie"&&(!e.category||e.category==="uncategorized")),H={isEssentialCategory:E,isResourceItem:k,isStorageItem:x,isBannerItem:ve,isGTMContainerScript:A,domResources:D,scripts:q,iframes:Ee,links:Se,noscripts:we,unblockedDOMResources:Ie,unblockedScripts:Te,storageResources:M,cookies:B,localStorage:Re,sessionStorage:Le,unblockedStorageResources:Ae,unblockedCookies:$,unblockedLocalStorage:W,unblockedSessionStorage:Y,uncategorizedCookies:U};var De=[{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]}}],J=/youtube\.com|youtu\.be|vimeo\.com|player\.vimeo/i,ee=/maps\.google|maps\.googleapis|google\.com\/maps/i,te=/fonts\.googleapis\.com|fonts\.gstatic\.com/i,oe=/googletagmanager\.com|gtm\.js/i,Me=/cdn\.intellimize\.co\/snippet\/\d+\.js/i,Z=/intellimize/i,P={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 ne(t){let e=[];e.push(He(t)),e.push(Pe(t)),e.push(ze(t)),e.push(X(t)),e.push(Ne(t)),e.push($e(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(Oe(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 O(t){if(!t.results)throw new Error("No results found in response for compliance evaluation");return ne(t.results)}function He(t){let e=t.detectedItems.filter(k).filter(s=>J.test(s.domain)||J.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 Pe(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-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 ze(t){let e=t.detectedItems.filter(k).filter(n=>te.test(n.domain)||te.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){if(t.detectedCmps&&t.detectedCmps.length>0)return{id:"consent-tool",name:"Consent Tool Detection",description:"Check if a cookie consent management tool is installed",status:"pass",details:`Detected consent tool(s): ${t.detectedCmps.map(r=>r.version?`${r.name} (v${r.version})`:r.name).join(", ")}`};let e=[],o=new Map;for(let s of De){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 Ne(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!(oe.test(s)||oe.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 $e(t){let e=$(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 Ue(t){let e=U(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 Oe(t){let e=t.detectedItems??[];if(!e.some(l=>k(l)&&l.type==="script"&&Me.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"&&Z.test(l.name)),r=e.filter(l=>x(l)&&l.type==="session-storage"&&Z.test(l.name)),a=e.filter(l=>x(l)&&l.type==="local-storage"&&Z.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 K(t){if(t.detectedCmps&&t.detectedCmps.length>0)return t.detectedCmps.map(n=>n.name).join(", ");let e=X(t);return e.status!=="pass"||!e.details?null:e.details.match(/Detected consent tool\(s\): (.+)/)?.[1]?.trim()??null}function se(t){return ne(t).criteria.filter(o=>o.status==="fail").map(o=>`${o.name}: ${o.details}`)}function re(t){let e=[],o=t.detectedItems??[],n=D(o),s=M(o),r=n.some(d=>d.type==="script"&&d.isThirdParty&&P.ga4.pattern.test(d.source)&&!A(d)),a=n.some(d=>d.type==="script"&&d.isThirdParty&&P.metaPixel.pattern.test(d.source)),c=n.some(d=>d.type==="script"&&d.isThirdParty&&P.bingUET.pattern.test(d.source)),l=n.some(d=>d.type==="script"&&d.isThirdParty&&P.hotjar.pattern.test(d.source)),m=n.some(d=>d.type==="script"&&d.isThirdParty&&P.clarity.pattern.test(d.source));r&&e.push("Google Analytics 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=$(s);f.length>0&&e.push(`${f.length} non-essential cookies set before consent`);let p=U(s);p.length>0&&e.push(`${p.length} uncategorized cookies detected - review and categorize`);let h=W(s),u=Y(s),y=h.length+u.length;return y>0&&e.push(`${y} localStorage/sessionStorage items set pre-consent`),K(t)||e.push("No consent management platform detected"),e}var _e=localStorage.getItem("cs-dev")==="true",z=_e?"https://fs-consentpro-api-dev.finsweet.workers.dev":"https://api.consentpro.com",Gt=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 ie(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 ae(t){let e=O(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function ce(t){if(!t.results)throw new Error("No results found in response for actionable items extraction");let{results:e}=t,o=q(e.detectedItems).length,n=B(e.detectedItems).length,s=K(e);return{scripts:o,cookies:n,cmpInstalled:s??void 0}}function le(t){if(!t.results)throw new Error("No results found in response for violations extraction");return se(t.results)}function me(t){if(!t.results)throw new Error("No results found in response for detected items extraction");let{results:e}=t,o=D(e.detectedItems),n=M(e.detectedItems);return{dom:o,storage:n}}function pe(t){let e=O(t);return{pass:e.summary.passed,fail:e.summary.failed,warn:e.summary.warnings,unverified:e.summary.notVerifiable}}function ue(t){if(!t.results)throw new Error("No results found in response for attention items extraction");return re(t.results)}function de(t){if(!t.results)throw new Error("No results found in response for statistics extraction");let{results:e}=t;return{scanDuration:je(e.scanDuration),resourcesCount:e.detectedItems.length,firstParty:e.statistics?.firstPartyResources??0,thirdParty:e.statistics?.thirdPartyResources??0,categories:Object.keys(e.statistics?.categoryCounts||{}).length}}function Fe(t){return O(t)}function Ge(t){return{scanSummary:ie(t),compliance:ae(t),actionableItems:ce(t),violations:le(t),detectedItems:me(t),complianceSummary:pe(t),attentionItems:ue(t),statistics:de(t)}}function je(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 C={extractScanSummary:ie,extractCompliance:ae,extractActionableItems:ce,extractViolations:le,extractDetectedItems:me,extractComplianceSummary:pe,extractAttentionItems:ue,extractStatistics:de,extractFullCompliance:Fe,extractAll:Ge};var fe="data-fs-cs";var i=(t,e=document)=>e.querySelector(`[${fe}="${t}"]`),w=(t,e=document)=>e.querySelectorAll(`[${fe}="${t}"]`);var ge={"X-Finsweet-ConsentPro-Version":"v2"},ye={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},b=class extends Error{constructor(o,n,s){super(o);G(this,"status");G(this,"response");this.name="ScannerApiError",this.status=n,this.response=s}};async function _(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 b(`Report request failed: ${e}`,t.status,o)}return t.json()}var F={async startScan(t){let e=await fetch(`${z}/v2/scanner/public/scan`,{method:"POST",headers:ye,body:JSON.stringify({url:t,acceptAll:!1})});if(e.status===409){let n=await e.json().catch(()=>({}));throw new b("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 b(`Expected 201 Created but got ${e.status}`,e.status,n)}return await _(e)},async getStatus(t){let e=await fetch(`${z}/v2/scanner/public/status/${t}`,{headers:ge});return await _(e)},async getResults(t){let e=await fetch(`${z}/v2/scanner/public/results/${t}`,{headers:ge});return await _(e)},async cancelScan(t){let e=await fetch(`${z}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:ye});return await _(e)}};var 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="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>',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"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',We='<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>',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="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>',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"><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>',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"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></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"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',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"><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>',et={"warning-triangle":qe,"check-circle":Be,"close-circle":We,"circle-off":Ye,"alert-octagon":Ze,"chevron-right":Xe,"alert-circle":Ke,clock:Qe,"help-circle":Je},tt=(t,e)=>{let o=et[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=tt(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 ot=1e3,N={compliant:"check-circle",notCompliant:"close-circle",warning:"warning-triangle"},he={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"}},nt=()=>{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}},st=t=>{let e=i("current-scan-activity");e&&(e.textContent=t,console.log(`[Results] Current scan activity: ${t}`))},rt=(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}%)`)}},it=()=>{let t=i("scan-progress-container"),e=i("scan-error-container");t&&(t.style.display="flex"),e&&(e.style.display="none")},Q=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)},at=async t=>(it(),new Promise((e,o)=>{let n=setInterval(async()=>{try{let s=await F.getStatus(t);if(console.log("[Results] Polled scan status:",s),s.currentActivity&&st(s.currentActivity),s.progress){let{pagesScanned:r,totalPages:a}=s.progress;rt(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),Q(`Scan failed: ${r}`),clearInterval(n),o(new Error(r))}}catch(s){console.error("[Results] Error polling status:",s),Q("Unable to check scan status. Please try again."),clearInterval(n),o(s)}},ot)})),ct=()=>{let t=i("scan-status_style");t&&t.remove()},lt=async t=>F.getResults(t),mt=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})},pt=t=>{let e=C.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}}},ut=(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})},dt=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`},ft=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])},gt=t=>{if(!t.results)return;let{scanDuration:e,pagesScanned:o,detectedItems:n,scannedAt:s}=t.results;S("scan-duration-card",dt(e)),S("pages-scanned-card",o.length.toString()),S("items-detected-card",n.length.toString()),S("scan-date-card",ft(s))},yt=t=>{if(!t.results)return;let{detectedItems:e}=t.results,o=H.unblockedScripts(e).length,n=H.unblockedCookies(e).length,r=C.extractComplianceSummary(t).fail,{cmpInstalled:a}=C.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"),ht(!!a)},ht=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?N.compliant:N.notCompliant,{color:s,size:24}),n&&(n.textContent=t?"CMP Detected":"CMP Not Found"),e.style.backgroundColor=t?g.success:g.error},kt=t=>{let e=C.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:N.compliant,color:g.success,iconColor:g["success-foreground"]},partial:{label:"Partial Compliance",message:"Some issues found, but fixable. Let's get you compliant.",icon:N.warning,color:g.warning,iconColor:g["warning-foreground"]},"non-compliant":{label:"Not Compliant",message:"Major compliance gaps detected. Action needed ASAP.",icon:N.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},Ct=t=>{let e=C.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)})},vt=t=>{let e=C.extractDetectedItems(t),o=H.unblockedDOMResources(e.dom),n=H.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),v=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"),v){let L=u.category||"uncategorized";v.textContent=L,v.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),v.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),v=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"),v){let L=u.category||"uncategorized";v.textContent=L,v.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),v.classList.add(`is-${L}`)}m.appendChild(y)}))}},xt=t=>{let e=C.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)})}},bt=t=>{let e=C.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())}},Et=t=>{let e=C.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=he[r.status]||he["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)})},St=t=>{let e=C.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())}},wt=[{name:"websiteInfo",updater:mt},{name:"complianceScore",updater:pt,requiredElements:["compliance-score"]},{name:"primaryStats",updater:gt},{name:"secondaryStats",updater:yt},{name:"complianceContainer",updater:kt,requiredElements:["compliance-container"]},{name:"violationsList",updater:Ct,requiredElements:["violations-list"]},{name:"detectedItems",updater:vt},{name:"attentionItems",updater:xt},{name:"complianceSummary",updater:bt},{name:"complianceCriteria",updater:Et,requiredElements:["criteria-list"]},{name:"statistics",updater:St}],It=t=>{wt.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)}}),V()},Tt=async()=>{let t=nt();if(!t){console.error("[Results] Cannot fetch results without tracking ID");return}ut(`https://${t.site}`,t.site);try{await at(t.trackingId);let e=await lt(t.trackingId);console.log("[Results] Fetched results:",e),It(e),ct()}catch(e){console.error("[Results] Error during scan:",e);let o="An error occurred. Please try again.";e instanceof b&&e.response&&typeof e.response=="object"&&"error"in e.response?o=e.response.error:e instanceof Error&&(o=e.message),Q(o)}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{Tt()});})();
1
+ "use strict";(()=>{var we=Object.defineProperty;var Re=(t,e,n)=>e in t?we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var B=(t,e,n)=>Re(t,typeof e!="symbol"?e+"":e,n);var W=(t=document)=>t.documentElement.getAttribute("data-wf-site");var Y=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 n=e.require("ix2");if(n){let{store:o,actions:s}=n,{eventState:r}=o.getState().ixSession,i=Object.entries(r);t||n.destroy(),n.init(),await Promise.all(i.map(c=>o.dispatch(s.eventStateChanged(...c))))}}if(!t||t.includes("commerce")){let n=e.require("commerce"),o=W();n&&o&&(n.destroy(),n.init({siteId:o,apiUrl:"https://render.webflow.com"}))}if(t?.includes("lightbox")&&e.require("lightbox")?.ready(),t?.includes("slider")){let n=e.require("slider");n&&(n.redraw(),n.ready())}return t?.includes("tabs")&&e.require("tabs")?.redraw(),new Promise(n=>e.push(()=>n(void 0)))}};var x=t=>t.type==="script"||t.type==="iframe"||t.type==="link"||t.type==="noscript",I=t=>t.type==="cookie"||t.type==="local-storage"||t.type==="session-storage",Le=t=>t.type==="banner",Ae=["essential","necessary"],w=t=>!!t&&Ae.includes(t),Me=/googletagmanager\.com\/gtm\.js\?(?:[^"'#\s]*&)?id=(GTM-[A-Z0-9]+)/gi,Z=t=>t.type!=="script"?!1:Me.test(t.source),K=t=>t.filter(x),X=t=>t.filter(e=>e.type==="script"),De=t=>t.filter(e=>e.type==="iframe"),ze=t=>t.filter(e=>e.type==="link"),Pe=t=>t.filter(e=>e.type==="noscript"),He=t=>t.filter(e=>x(e)&&e.isThirdParty&&!w(e.category)&&!Z(e)),$e=t=>t.filter(e=>e.type==="script"&&e.isThirdParty&&!w(e.category)&&!Z(e)),z=t=>t.filter(I),Q=t=>t.filter(e=>e.type==="cookie"),Ne=t=>t.filter(e=>e.type==="local-storage"),Ue=t=>t.filter(e=>e.type==="session-storage"),Oe=t=>t.filter(e=>I(e)&&!w(e.category)),N=t=>t.filter(e=>e.type==="cookie"&&!w(e.category)),J=t=>t.filter(e=>e.type==="local-storage"&&!w(e.category)),ee=t=>t.filter(e=>e.type==="session-storage"&&!w(e.category)),U=t=>t.filter(e=>e.type==="cookie"&&(!e.category||e.category==="uncategorized")),_e=/google\s*tag\s*manager|^gtm$/i,te=t=>_e.test(t.label),O=t=>t.filter(e=>!w(e.category)&&!te(e)),Fe=(t,e)=>t.filter(n=>n.category===e),_=t=>t.filter(e=>e.category==="analytics"&&!te(e)),F=t=>t.filter(e=>e.category==="marketing"),Ve=t=>t.filter(e=>!e.category||e.category==="uncategorized"),S={isEssentialCategory:w,isResourceItem:x,isStorageItem:I,isBannerItem:Le,isGTMContainerScript:Z,isGTMContainerTracker:te,domResources:K,scripts:X,iframes:De,links:ze,noscripts:Pe,unblockedDOMResources:He,unblockedScripts:$e,storageResources:z,cookies:Q,localStorage:Ne,sessionStorage:Ue,unblockedStorageResources:Oe,unblockedCookies:N,unblockedLocalStorage:J,unblockedSessionStorage:ee,uncategorizedCookies:U,violatingTrackers:O,trackersByCategory:Fe,analyticsTrackers:_,marketingTrackers:F,uncategorizedTrackers:Ve};var je=[{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]}}],ie=/youtube\.com|youtu\.be|vimeo\.com|player\.vimeo/i,ae=/maps\.google|maps\.googleapis|google\.com\/maps/i,ce=/fonts\.googleapis\.com|fonts\.gstatic\.com/i,le=/googletagmanager\.com|gtm\.js/i,Ge=/cdn\.intellimize\.co\/snippet\/\d+\.js/i,ne=/intellimize/i;function me(t){let e=[];e.push(qe(t)),e.push(Be(t)),e.push(We(t)),e.push(Ye(t)),e.push(se(t)),e.push(Ze(t)),e.push(Ke(t)),e.push(Xe(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(Qe(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 n={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},o=e.filter(l=>l.status!=="not-verifiable");if(o.length===0)return{overallScore:0,hasViolations:n.failed>0,criteria:e,summary:n};let s=["pre-consent-trackers","consent-tool"],r=0,i=0;for(let l of o){let m=1;l.id==="pre-consent-trackers"?m=3:s.includes(l.id)&&(m=2);let g=l.status==="pass"?1:l.status==="warning"?.5:0;r+=g*m,i+=m}return{overallScore:Math.round(r/i*100),hasViolations:n.failed>0,criteria:e,summary:n}}function V(t){if(!t.results)throw new Error("No results found in response for compliance evaluation");return me(t.results)}function qe(t){let e=t.trackersInfo?.trackers??[],n=t.trackersInfo?.providers??[],o=new Map;n.forEach(g=>o.set(g.id,g.name));let s=O(e),r=_(e).length,i=F(e).length,c=[...new Set(s.map(g=>o.get(g.providerId)||g.name||g.domain||g.providerId))];if(s.length===0)return{id:"pre-consent-trackers",name:"Pre-Consent Trackers",description:"Check for tracking scripts running before user consent",status:"pass",details:"No tracking scripts detected running before consent."};let l=[];r>0&&l.push(`${r} analytics`),i>0&&l.push(`${i} marketing`);let m=s.length-r-i;return m>0&&l.push(`${m} other`),{id:"pre-consent-trackers",name:"Pre-Consent Trackers",description:"Check for tracking scripts running before user consent",status:"fail",details:`Found ${s.length} tracker(s) running before consent (${l.join(", ")}). These should be blocked until user provides consent.`,affectedItems:c}}function Be(t){let e=t.detectedItems.filter(x).filter(s=>ie.test(s.domain)||ie.test(s.source)),n=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 o=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. ${o.length} are third-party resources that may store cookies before consent.`,affectedItems:n}}function We(t){let e=t.detectedItems.filter(x).filter(o=>ae.test(o.domain)||ae.test(o.source)),n=e.map(o=>o.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:n}}function Ye(t){let e=t.detectedItems.filter(x).filter(o=>ce.test(o.domain)||ce.test(o.source)),n=e.map(o=>o.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 may violate data privacy regulations (GDPR, CCPA, HIPAA, etc.). Fonts should be self-hosted or loaded only after consent.`,affectedItems:n}}function se(t){if(t.detectedCmps&&t.detectedCmps.length>0)return{id:"consent-tool",name:"Consent Tool Detection",description:"Check if a cookie consent management tool is installed",status:"pass",details:`Detected consent tool(s): ${t.detectedCmps.map(r=>r.version?`${r.name} (v${r.version})`:r.name).join(", ")}`};let e=[],n=new Map;for(let s of je){let r=0;if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let i of t.detectedItems)if(x(i)&&i.type==="script"){let{source:c}=i,l=i.element?.outerHTML||"";for(let m of s.patterns.scripts)if(m.test(c)||m.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 c=i.name||"";for(let l of s.patterns.scripts)if(l.test(c)){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(I(i)&&i.type==="cookie"){let{name:c}=i;for(let l of s.patterns.cookies)if(l.test(c)){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=x(i)&&i.element?.outerHTML||"";for(let m of s.patterns.dom)if(m.test(l)){r+=1,e.includes(i.id)||e.push(i.id);break}}r>0&&n.set(s.name,r)}let o=Array.from(n.entries()).sort((s,r)=>r[1]-s[1]).map(([s])=>s);return o.length===0?{id:"consent-tool",name:"No cookie consent tool detected",description:"Check if a cookie consent management tool is installed",status:"fail",details:"A consent banner is required for data privacy compliance in many regions. If stricter data privacy laws apply to you, you are not compliant."}:{id:"consent-tool",name:"Consent Tool Detection",description:"Check if a cookie consent management tool is installed",status:"pass",details:`Detected consent tool(s): ${o.join(", ")}`,affectedItems:e}}function Ze(t){let e=t.detectedItems.filter(o=>{if(!x(o)||o.category!=="uncategorized"||!o.isThirdParty)return!1;let s=o.domain??"",r=o.source??"";return!(le.test(s)||le.test(r))}),n=e.map(o=>o.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:n}}function Ke(t){let e=N(t.detectedItems),n=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:n}}function Xe(t){let e=U(t.detectedItems),n=e.map(o=>o.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:n}}function Qe(t){let e=t.detectedItems??[];if(!e.some(l=>x(l)&&l.type==="script"&&Ge.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(se(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=>I(l)&&l.type==="cookie"&&ne.test(l.name)),r=e.filter(l=>I(l)&&l.type==="session-storage"&&ne.test(l.name)),i=e.filter(l=>I(l)&&l.type==="local-storage"&&ne.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)`),i.length>0&&c.push(`${i.length} local-storage key(s)`),c.length>0){let l=[...s.map(m=>m.id),...r.map(m=>m.id),...i.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 re(t){if(t.detectedCmps&&t.detectedCmps.length>0)return t.detectedCmps.map(o=>o.name).join(", ");let e=se(t);return e.status!=="pass"||!e.details?null:e.details.match(/Detected consent tool\(s\): (.+)/)?.[1]?.trim()??null}function ue(t){return me(t).criteria.filter(n=>n.status==="fail").map(n=>`${n.name}: ${n.details}`)}function de(t){let e=[],n=t.trackersInfo?.trackers??[],o=t.trackersInfo?.providers??[],s=t.detectedItems??[],r=z(s),i=new Map;o.forEach(y=>i.set(y.id,y.name));let c=O(n),l=_(n),m=F(n);if(l.length>0){let y=oe(l,3,i);e.push(`${l.length} analytics tracker(s) running before consent: ${y}`)}if(m.length>0){let y=oe(m,3,i);e.push(`${m.length} marketing tracker(s) firing before consent: ${y}`)}let g=c.filter(y=>y.category!=="analytics"&&y.category!=="marketing");if(g.length>0){let y=oe(g,3,i);e.push(`${g.length} other tracker(s) need consent: ${y}`)}let k=N(r);k.length>0&&e.push(`${k.length} non-essential cookies set before consent`);let u=U(r);u.length>0&&e.push(`${u.length} uncategorized cookies detected - review and categorize`);let d=J(r),f=ee(r),v=d.length+f.length;return v>0&&e.push(`${v} localStorage/sessionStorage items set pre-consent`),re(t)||e.push("No consent management platform detected"),e}function oe(t,e,n){let o=[...new Set(t.map(s=>n.get(s.providerId)||s.name||s.domain||"Unknown"))];return o.length<=e?o.join(", "):`${o.slice(0,e).join(", ")} +${o.length-e} more`}var Je=localStorage.getItem("cs-dev")==="true",P=Je?"https://fs-consentpro-api-dev.finsweet.workers.dev":"https://api.consentpro.com",on=1440*60*1e3;var h={success:"#07601d",warning:"#bb5902",error:"#8F0C3D",info:"#598FFF","success-foreground":"#25fc54","warning-foreground":"#FFAA00","error-foreground":"#FF265A","info-foreground":"#d5e8ff"};function pe(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 ge(t){let e=V(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function fe(t){if(!t.results)throw new Error("No results found in response for actionable items extraction");let{results:e}=t,n=X(e.detectedItems).length,o=Q(e.detectedItems).length,s=re(e);return{scripts:n,cookies:o,cmpInstalled:s??void 0}}function ye(t){if(!t.results)throw new Error("No results found in response for violations extraction");return ue(t.results)}function he(t){if(!t.results)throw new Error("No results found in response for detected items extraction");let{results:e}=t,n=K(e.detectedItems),o=z(e.detectedItems);return{dom:n,storage:o}}function ke(t){let e=V(t);return{pass:e.summary.passed,fail:e.summary.failed,warn:e.summary.warnings,unverified:e.summary.notVerifiable}}function ve(t){if(!t.results)throw new Error("No results found in response for attention items extraction");return de(t.results)}function Ce(t){if(!t.results)throw new Error("No results found in response for statistics extraction");let{results:e}=t;return{scanDuration:nt(e.scanDuration),resourcesCount:e.detectedItems.length,firstParty:e.statistics?.firstPartyResources??0,thirdParty:e.statistics?.thirdPartyResources??0,categories:Object.keys(e.statistics?.categoryCounts||{}).length}}function et(t){return V(t)}function tt(t){return{scanSummary:pe(t),compliance:ge(t),actionableItems:fe(t),violations:ye(t),detectedItems:he(t),complianceSummary:ke(t),attentionItems:ve(t),statistics:Ce(t)}}function nt(t){let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let n=Math.floor(e/60),o=e%60;return`${n}m ${o}s`}var T={extractScanSummary:pe,extractCompliance:ge,extractActionableItems:fe,extractViolations:ye,extractDetectedItems:he,extractComplianceSummary:ke,extractAttentionItems:ve,extractStatistics:Ce,extractFullCompliance:et,extractAll:tt};var be="data-fs-cs";var a=(t,e=document)=>e.querySelector(`[${be}="${t}"]`),A=(t,e=document)=>e.querySelectorAll(`[${be}="${t}"]`);var Ee={"X-Finsweet-ConsentPro-Version":"v2"},xe={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},R=class extends Error{constructor(n,o,s){super(n);B(this,"status");B(this,"response");this.name="ScannerApiError",this.status=o,this.response=s}};async function j(t){if(!t.ok){let e=t.statusText,n;try{let o=await t.json();n=o,o&&typeof o.error=="string"&&(e=o.error)}catch{n=await t.text().catch(()=>"Unknown error")}throw new R(`Report request failed: ${e}`,t.status,n)}return t.json()}var G={async startScan(t){let e=await fetch(`${P}/v2/scanner/public/scan`,{method:"POST",headers:xe,body:JSON.stringify({url:t,acceptAll:!1})});if(e.status===409){let o=await e.json().catch(()=>({}));throw new R("A scan is already in progress for this website. Please wait for it to complete.",409,o)}if(e.status!==201){let o=await e.text().catch(()=>"Unknown error");throw new R(`Expected 201 Created but got ${e.status}`,e.status,o)}return await j(e)},async getStatus(t){let e=await fetch(`${P}/v2/scanner/public/status/${t}`,{headers:Ee});return await j(e)},async getResults(t){let e=await fetch(`${P}/v2/scanner/public/results/${t}`,{headers:Ee});return await j(e)},async cancelScan(t){let e=await fetch(`${P}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:xe});return await j(e)}};var st='<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>',rt='<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>',it='<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>',at='<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>',ct='<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>',lt='<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>',mt='<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>',ut='<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>',dt='<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>',pt={"warning-triangle":st,"check-circle":rt,"close-circle":it,"circle-off":at,"alert-octagon":ct,"chevron-right":lt,"alert-circle":mt,clock:ut,"help-circle":dt},gt=(t,e)=>{let n=pt[t];return e?.color&&(n=n.replace(/currentColor/g,e.color)),e?.size&&(n=n.replace("<svg",`<svg width="${e.size}" height="${e.size}"`)),n},M=(t,e,n)=>{let o=gt(e,n),s=document.createElement("template");s.innerHTML=o.trim();let r=s.content.firstElementChild;if(!r)return null;if(r.setAttribute("data-fs-icon",e),n?.size&&(r.style.setProperty("width",`${n.size}px`,"important"),r.style.setProperty("height",`${n.size}px`,"important")),t.className){let i=r.getAttribute("class")||"";r.setAttribute("class",`${i} ${t.className}`.trim())}return t.replaceWith(r),r};var ft=1e3,$={compliant:"check-circle",notCompliant:"close-circle",warning:"warning-triangle"},Se={pass:{icon:"check-circle",color:h["success-foreground"],label:"pass"},fail:{icon:"alert-circle",color:h["error-foreground"],label:"fail"},warning:{icon:"warning-triangle",color:h["warning-foreground"],label:"warning"},"not-verifiable":{icon:"help-circle",color:h.info,label:"not verifiable"}},yt=()=>{let t=new URLSearchParams(window.location.search),e=t.get("trid"),n=t.get("site");return!e||!n?(console.error("[Results] Missing required query parameters:",{trid:e,site:n}),window.location.assign("/scan"),null):{trackingId:e,site:n}},ht=t=>{let e=a("current-scan-activity");e&&(e.textContent=t,console.log(`[Results] Current scan activity: ${t}`))},kt=(t,e)=>{let n=a("scan-progress");if(n){let o=e>0?Math.round(t/e*100):0;n.textContent=`${t} / ${e} pages (${o}%)`,console.log(`[Results] Scan progress: ${t} / ${e} pages (${o}%)`)}},vt=()=>{let t=a("scan-progress-container"),e=a("scan-error-container");t&&(t.style.display="flex"),e&&(e.style.display="none")},q=t=>{let e=a("scan-progress-container"),n=a("scan-error-container"),o=a("current-scan-error");e&&(e.style.display="none"),n&&(n.style.display="flex"),o&&(o.innerHTML=t)},Ct=async t=>(vt(),new Promise((e,n)=>{let o=setInterval(async()=>{try{let s=await G.getStatus(t);if(console.log("[Results] Polled scan status:",s),s.currentActivity&&ht(s.currentActivity),s.progress){let{pagesScanned:r,totalPages:i}=s.progress;kt(r,i)}if(s.status==="completed")clearInterval(o),e();else if(s.status==="failed"){let r=s.error||"Scan failed unexpectedly";console.error("[Results] Scan failed:",r),q(`Scan failed: ${r}`),clearInterval(o),n(new Error(r))}}catch(s){console.error("[Results] Error polling status:",s),q("Unable to check scan status. Please try again."),clearInterval(o),n(s)}},ft)})),bt=()=>{let t=a("scan-status_style");t&&t.remove()},Et=async t=>G.getResults(t),xt=t=>{if(!t.results)return null;let{pagesScanned:e,issues:n}=t.results;return e.length>0?null:n.siteInaccessible?n.siteInaccessible:n.notFound&&n.notFound.length>0?"<strong>No pages found</strong><br><br>We couldn't find any pages at the URL you provided. Please ensure you entered the correct URL and try scanning again.":"<strong>Scan completed with no pages</strong><br><br>No pages were scanned. Please verify the URL is correct and the site is publicly accessible, then try again."},St=t=>{if(!t.results)return;let{origin:e}=t.results,n=new URL(e).hostname;A("target-website").forEach(r=>{r.textContent=n}),A("target-website-url").forEach(r=>{r instanceof HTMLAnchorElement?r.href=e:r.textContent=e})},Tt=t=>{let e=T.extractFullCompliance(t),n=a("compliance-score");if(n){let o=a("value",n);if(o){let s=Math.round(e.overallScore);o.textContent=`${s}%`;let r;s>=80?r=h["success-foreground"]:s>=50?r=h["warning-foreground"]:r=h["error-foreground"],o.style.color=r}}},It=(t,e)=>{A("target-website").forEach(s=>{s.textContent=e}),A("target-website-url").forEach(s=>{s instanceof HTMLAnchorElement?s.href=t:s.textContent=t})},wt=t=>{let e=Math.floor(t/1e3);if(e<60)return`${e}s`;let n=Math.floor(e/60),o=e%60;return`${n}m ${o}s`},Rt=t=>new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),L=(t,e,n,o)=>{let s=a(t);if(!s)return;let r=a("value",s),i=a("text",s);r&&(r.textContent=e),i&&n&&(i.textContent=n),o&&(s.style.backgroundColor=h[o])},Lt=t=>{if(!t.results)return;let{scanDuration:e,pagesScanned:n,detectedItems:o,scannedAt:s}=t.results;L("scan-duration-card",wt(e)),L("pages-scanned-card",n.length.toString()),L("items-detected-card",o.length.toString()),L("scan-date-card",Rt(s))},At=t=>{if(!t.results)return;let{detectedItems:e,trackersInfo:n}=t.results,o=S.unblockedScripts(e).length,s=S.unblockedCookies(e).length,i=S.violatingTrackers(n?.trackers??[]).length,c=o+s+i,{cmpInstalled:l}=T.extractActionableItems(t);L("scripts-detected-card",o.toString(),void 0,o===0?"success":"error"),L("cookies-detected-card",s.toString(),void 0,s===0?"success":"warning"),L("action-items-card",c.toString(),"Violations",c===0?"success":"error"),Mt(!!l)},Mt=t=>{let e=a("cmp-status-card");if(!e)return;let n=a("icon",e),o=a("text",e),s=t?h["success-foreground"]:h["error-foreground"];n&&M(n,t?$.compliant:$.notCompliant,{color:s,size:24}),o&&(o.textContent=t?"CMP Detected":"CMP Not Found"),e.style.backgroundColor=t?h.success:h.error},Dt=t=>{if(!t.results)return;let{detectedItems:e,trackersInfo:n}=t.results,o=A("compliance-container");if(o.length===0)return;let{cmpInstalled:s}=T.extractActionableItems(t),r=!!s,i=S.unblockedScripts(e).length,c=S.unblockedCookies(e).length,m=S.violatingTrackers(n?.trackers??[]).length,g=i+c+m,k;r?g===0?k="compliant":g<=2?k="partial":k="non-compliant":k="non-compliant";let u=()=>{if(!r)return"No Consent Management Platform detected. CMP is required for privacy compliance.";if(g===0)return"No pre-consent violations detected. Nice work!";let p=[];return i>0&&p.push(`${i} script${i>1?"s":""} to fix`),c>0&&p.push(`${c} cookie${c>1?"s":""} to fix`),m>0&&p.push(`${m} tracker violation${m>1?"s":""}`),k==="partial"?`Found ${p.join(", ")}. Let's get you compliant.`:`Major compliance gaps: ${p.join(", ")}. Action needed ASAP.`},f={compliant:{label:"Compliant",message:u(),icon:$.compliant,color:h.success,iconColor:h["success-foreground"]},partial:{label:"Partial Compliance",message:u(),icon:$.warning,color:h.warning,iconColor:h["warning-foreground"]},"non-compliant":{label:"Not Compliant",message:u(),icon:$.notCompliant,color:h.error,iconColor:h["error-foreground"]}}[k];o.forEach(p=>{p.setAttribute("fs-cloak",""),p.classList.add("hide")});let v=null;o.forEach(p=>{(k==="compliant"&&p.classList.contains("compliant")||k!=="compliant"&&!p.classList.contains("compliant"))&&(v=p)}),v||([v]=o),v.removeAttribute("fs-cloak"),v.classList.remove("hide");let y=a("compliance-status",v);if(y){let p=a("icon",y),C=a("text",y);p&&M(p,f.icon,{color:f.iconColor,size:30}),C&&(C.textContent=f.label)}let E=a("compliance-details",v);E&&(E.textContent=f.message);let b=a("violations-wrapper",v);if(b){let p=a("value",b);p&&(p.textContent=g.toString())}v.style.backgroundColor=f.color},zt=t=>{if(!t.results)return;let{trackersInfo:e}=t.results,n=a("violations-component"),o=a("violations-list"),s=a("violation-template");if(!o||!s)return;let r=S.violatingTrackers(e?.trackers??[]);if(n){let u=a("icon",n);u&&M(u,"alert-octagon",{color:h["error-foreground"],size:24})}Array.from(o.children).forEach(u=>{u!==s&&u.remove()}),s.style.display="none";let c=a("violations-list-empty");if(r.length===0){c&&(c.removeAttribute("fs-cloak"),c.classList.remove("hide")),o.setAttribute("fs-cloak",""),o.classList.add("hide");return}c&&(c.setAttribute("fs-cloak",""),c.classList.add("hide")),o.removeAttribute("fs-cloak"),o.classList.remove("hide");let l=e?.providers??[],m=new Map;l.forEach(u=>m.set(u.id,u.name));let g={analytics:"\u{1F4CA}",marketing:"\u{1F4E2}",advertising:"\u{1F4FA}",functional:"\u2699\uFE0F",uncategorized:"\u2753"},k=new Set;r.forEach(u=>{let f=m.get(u.providerId)||u.name||u.domain||u.providerId||"Unknown",v=`${u.category}-${f}`;if(k.has(v))return;k.add(v);let y=s.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let E=a("icon",y);E&&M(E,"chevron-right",{color:h["error-foreground"],size:16});let b=a("text",y);if(b){let p=g[u.category]??"\u{1F534}",C=u.category||"uncategorized";b.textContent=`${p} ${f}: ${C} tracker running before consent`}o.appendChild(y)})},Pt=t=>{let e=t?.toLowerCase()||"uncategorized";return["uncategorized","unknown","marketing","advertising"].includes(e)?h["error-foreground"]:["analytics","performance","functional","personalization"].includes(e)?h["warning-foreground"]:["essential","necessary","strictly-necessary","strictly_necessary"].includes(e)?null:h["error-foreground"]},H=t=>{let e=t?.toLowerCase()||"uncategorized";return["uncategorized","unknown"].includes(e)?1:["marketing","advertising"].includes(e)?2:["analytics","performance"].includes(e)?3:["functional","personalization"].includes(e)?4:["essential","necessary","strictly-necessary","strictly_necessary"].includes(e)?5:1},Te=t=>{switch(H(t)){case 1:return"Highest Violation Risk - Uncategorized resource requiring immediate attention";case 2:return"High Violation Risk - Marketing/Advertising tracker requiring consent";case 3:return"Medium Violation Risk - Analytics/Performance tracker requiring consent";case 4:return"Low Violation Risk - Functional resource that may require consent";case 5:return"No Violation Risk - Essential resource";default:return"Unknown risk level"}},Ie=t=>{let e=Pt(t);return e?e===h["error-foreground"]?"brightness(0) saturate(100%) invert(21%) sepia(100%) saturate(7000%) hue-rotate(336deg) brightness(100%) contrast(105%)":e===h["warning-foreground"]?"brightness(0) saturate(100%) invert(68%) sepia(78%) saturate(1000%) hue-rotate(4deg) brightness(103%) contrast(104%)":null:null},Ht=t=>{let e=T.extractDetectedItems(t),n=[...e.dom].filter(u=>!S.isEssentialCategory(u.category)).sort((u,d)=>H(u.category)-H(d.category)),o=[...e.storage].filter(u=>!S.isEssentialCategory(u.category)).sort((u,d)=>H(u.category)-H(d.category)),s=a("scripts-component"),r=a("script-list"),i=a("script-item"),c=a("script-list-empty");if(r&&i){if(s){let d=a("scripts-title",s);d&&(d.textContent=`Scripts Requiring Consent (${n.length})`)}Array.from(r.children).forEach(d=>{d!==i&&d.remove()}),i.style.display="none",n.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"),n.forEach(d=>{let f=i.cloneNode(!0);f.removeAttribute("data-fs-cs"),f.style.display="";let v=a("script-title",f),y=a("script-url",f),E=a("script-type",f),b=a("script-tag",f),p=a("icon",f);if(v&&(v.textContent=`${d.domain||`Unknown ${d.type}`}`),y&&(y.textContent=d.source?.slice(0,100)||"N/A"),E&&(E.textContent=d.type||"N/A"),b){let C=d.category||"uncategorized";b.textContent=C,b.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),b.classList.add(`is-${C}`)}if(p){let C=d.category||"uncategorized",D=Ie(C);D?(p.style.display="",p.style.filter=D,p.title=Te(C)):p.style.display="none"}r.appendChild(f)}))}let l=a("cookies-component"),m=a("cookie-list"),g=a("cookie-item"),k=a("cookie-list-empty");if(m&&g){if(l){let d=a("cookies-title",l);d&&(d.textContent=`Cookies Requiring Consent (${o.length})`)}Array.from(m.children).forEach(d=>{d!==g&&d.remove()}),g.style.display="none",o.length===0?(k&&(k.removeAttribute("fs-cloak"),k.classList.remove("hide")),m.setAttribute("fs-cloak",""),m.classList.add("hide")):(k&&(k.setAttribute("fs-cloak",""),k.classList.add("hide")),m.removeAttribute("fs-cloak"),m.classList.remove("hide"),o.forEach(d=>{let f=g.cloneNode(!0);f.removeAttribute("data-fs-cs"),f.style.display="";let v=a("cookie-name",f),y=a("cookie-url",f),E=a("cookie-type",f),b=a("cookie-tag",f),p=a("icon",f);if(v&&(v.textContent=`${d.name||`Unknown ${d.type}`}`),y&&(y.textContent=d.domain||"N/A"),E&&(E.textContent=d.type||"N/A"),b){let C=d.category||"uncategorized";b.textContent=C,b.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),b.classList.add(`is-${C}`)}if(p){let C=d.category||"uncategorized",D=Ie(C);D?(p.style.display="",p.style.filter=D,p.title=Te(C)):p.style.display="none"}m.appendChild(f)}))}},$t=t=>{let e=T.extractAttentionItems(t),n=a("attention-list"),o=a("attention-item"),s=a("attention-list-empty");if(!(!n||!o)){if(o.style.display="none",e.length===0){s&&(s.removeAttribute("fs-cloak"),s.classList.remove("hide")),n.setAttribute("fs-cloak",""),n.classList.add("hide");return}s&&(s.setAttribute("fs-cloak",""),s.classList.add("hide")),n.removeAttribute("fs-cloak"),n.classList.remove("hide"),e.forEach((r,i)=>{let c=o.cloneNode(!0);c.removeAttribute("data-fs-cs"),c.style.display="";let l=a("value",c);l&&(l.textContent=(i+1).toString());let m=a("text",c);m&&(m.textContent=r),n.appendChild(c)})}},Nt=t=>{let e=T.extractComplianceSummary(t),n=a("passed-items");if(n){let i=a("value",n);i&&(i.textContent=e.pass.toString())}let o=a("failed-items");if(o){let i=a("value",o);i&&(i.textContent=e.fail.toString())}let s=a("warning-items");if(s){let i=a("value",s);i&&(i.textContent=e.warn.toString())}let r=a("unverified-items");if(r){let i=a("value",r);i&&(i.textContent=e.unverified.toString())}},Ut=t=>{let e=T.extractFullCompliance(t),n=a("criteria-list"),o=a("criteria-item");if(!n||!o)return;Array.from(n.children).forEach(i=>{i!==o&&i.remove()}),o.style.display="none",e.criteria.filter(i=>i.status!=="not-verifiable").forEach(i=>{let c=o.cloneNode(!0);c.removeAttribute("data-fs-cs"),c.style.display="";let l=Se[i.status]||Se["not-verifiable"],m=a("icon",c);m&&M(m,l.icon,{color:l.color,size:24});let g=a("criteria-title",c),k=a("criteria-description",c);g&&(g.textContent=i.name),k&&(k.textContent=i.description);let u=a("criteria-status",c);u&&(u.textContent=l.label);let d=a("criteria-answer",c);d&&(d.textContent=i.details||"No additional details available."),n.appendChild(c)})},Ot=t=>{let e=T.extractStatistics(t),n=a("stat-duration");if(n){let c=a("value",n);c&&(c.textContent=e.scanDuration)}let o=a("stat-resources");if(o){let c=a("value",o);c&&(c.textContent=e.resourcesCount.toString())}let s=a("stat-first-party");if(s){let c=a("value",s);c&&(c.textContent=e.firstParty.toString())}let r=a("stat-third-party");if(r){let c=a("value",r);c&&(c.textContent=e.thirdParty.toString())}let i=a("stat-categories");if(i){let c=a("value",i);c&&(c.textContent=e.categories.toString())}},_t=[{name:"websiteInfo",updater:St},{name:"complianceScore",updater:Tt,requiredElements:["compliance-score"]},{name:"primaryStats",updater:Lt},{name:"secondaryStats",updater:At},{name:"complianceContainer",updater:Dt,requiredElements:["compliance-container"]},{name:"violationsList",updater:zt,requiredElements:["violations-list"]},{name:"detectedItems",updater:Ht},{name:"attentionItems",updater:$t},{name:"complianceSummary",updater:Nt},{name:"complianceCriteria",updater:Ut,requiredElements:["criteria-list"]},{name:"statistics",updater:Ot}],Ft=t=>{_t.forEach(({name:e,updater:n,requiredElements:o})=>{try{if(o&&o.find(r=>!a(r)))return;n(t)}catch(s){console.error(`[Results] Error in updater "${e}":`,s)}}),Y()},Vt=async()=>{let t=yt();if(!t){console.error("[Results] Cannot fetch results without tracking ID");return}It(`https://${t.site}`,t.site);try{await Ct(t.trackingId);let e=await Et(t.trackingId);console.log("[Results] Fetched results:",e);let n=xt(e);if(n){q(n);return}Ft(e),bt()}catch(e){console.error("[Results] Error during scan:",e);let n="An error occurred. Please try again.";e instanceof R&&e.response&&typeof e.response=="object"&&"error"in e.response?n=e.response.error:e instanceof Error&&(n=e.message),q(n)}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{Vt()});})();
package/dist/scan.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var T=Object.defineProperty;var E=(t,e,n)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var m=(t,e,n)=>E(t,typeof e!="symbol"?e+"":e,n);var v=localStorage.getItem("cs-dev")==="true",a=v?"https://fs-consentpro-api-dev.finsweet.workers.dev":"https://api.consentpro.com",X=1440*60*1e3;var C="data-fs-cs";var i=(t,e=document)=>e.querySelector(`[${C}="${t}"]`);var g=t=>{let e=t.trim();if(!e||!/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(e)&&e.includes("@"))return null;try{let o=p(e),s=new URL(o);return s.protocol!=="http:"&&s.protocol!=="https:"||!s.hostname||!s.hostname.includes(".")?null:s}catch{return null}};var y={"X-Finsweet-ConsentPro-Version":"v2"},h={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},r=class extends Error{constructor(n,o,s){super(n);m(this,"status");m(this,"response");this.name="ScannerApiError",this.status=o,this.response=s}};async function c(t){if(!t.ok){let e=t.statusText,n;try{let o=await t.json();n=o,o&&typeof o.error=="string"&&(e=o.error)}catch{n=await t.text().catch(()=>"Unknown error")}throw new r(`Report request failed: ${e}`,t.status,n)}return t.json()}var u={async startScan(t){let e=await fetch(`${a}/v2/scanner/public/scan`,{method:"POST",headers:h,body:JSON.stringify({url:t,acceptAll:!1})});if(e.status===409){let o=await e.json().catch(()=>({}));throw new r("A scan is already in progress for this website. Please wait for it to complete.",409,o)}if(e.status!==201){let o=await e.text().catch(()=>"Unknown error");throw new r(`Expected 201 Created but got ${e.status}`,e.status,o)}return await c(e)},async getStatus(t){let e=await fetch(`${a}/v2/scanner/public/status/${t}`,{headers:y});return await c(e)},async getResults(t){let e=await fetch(`${a}/v2/scanner/public/results/${t}`,{headers:y});return await c(e)},async cancelScan(t){let e=await fetch(`${a}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:h});return await c(e)}},p=t=>{let e=t.trim();return!e.startsWith("http://")&&!e.startsWith("https://")&&(e="https://"+e),e};var S="[Scan]",k="Please enter a valid URL (e.g. https://example.com).",w="Failed to start scan. Please try again.",b="/result",R=()=>{let t=i("scan-form"),e=i("scan-url-input"),n=i("scan-submit"),o=i("form-error"),s=i("form-error-text");return!t||!e||!n||!o||!s?(console.error(`${S} Missing elements:`,{form:!!t,urlInput:!!e,submitButton:!!n,errorDiv:!!o,errorText:!!s}),null):{form:t,urlInput:e,submitButton:n,errorDiv:o,errorText:s}},d=(t,e)=>{t.errorText.innerHTML=e,t.errorDiv.style.display="flex"},D=t=>{t.errorDiv.style.display="none",t.errorText.innerHTML=""},M=(t,e)=>{let n=t.value.trim();if(!n)return d(e,k),null;let o=g(n);return o||(d(e,k),null)},L=t=>{let e=t.dataset.wait;e&&(t.value=e)},A=(t,e)=>{t.value=e,t.disabled=!1},H=t=>`${t.origin}${t.pathname}`,P=async(t,e,n)=>{try{let o=await u.startScan(H(t));if(!o.trackingId)throw new Error("No tracking ID returned");let s=new URL(b,window.location.origin);s.searchParams.set("trid",o.trackingId),s.searchParams.set("site",t.hostname),window.location.href=s.href}catch(o){if(console.error(`${S} Scan failed:`,o),o instanceof r&&o.status===409){let f=o.response?.trackingId;if(f){let l=new URL(b,window.location.origin);l.searchParams.set("trid",f),l.searchParams.set("site",t.hostname),window.location.href=l.href;return}}let s=o instanceof r?`Scan failed: ${o.message}`:w;d(e,s),A(e.submitButton,n)}},z=async(t,e)=>{t.preventDefault(),t.stopPropagation(),D(e);let n=M(e.urlInput,e);if(!n)return;e.urlInput.value=n.href;let o=e.submitButton.value||"Scan";L(e.submitButton),e.submitButton.disabled=!0,await P(n,e,o)},_=()=>{let t=R();t&&t.form.addEventListener("submit",e=>z(e,t),{capture:!0})};window.Webflow||(window.Webflow=[]);window.Webflow.push(_);})();
1
+ "use strict";(()=>{var S=Object.defineProperty;var I=(t,e,n)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var m=(t,e,n)=>I(t,typeof e!="symbol"?e+"":e,n);var v=localStorage.getItem("cs-dev")==="true",a=v?"https://fs-consentpro-api-dev.finsweet.workers.dev":"https://api.consentpro.com",Z=1440*60*1e3;var x="data-fs-cs";var i=(t,e=document)=>e.querySelector(`[${x}="${t}"]`);var f=t=>{let e=t.trim();if(!e||!/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(e)&&e.includes("@"))return null;try{let o=p(e),r=new URL(o);return r.protocol!=="http:"&&r.protocol!=="https:"||!r.hostname||!r.hostname.includes(".")?null:r}catch{return null}};var y={"X-Finsweet-ConsentPro-Version":"v2"},k={"X-Finsweet-ConsentPro-Version":"v2","Content-Type":"application/json"},s=class extends Error{constructor(n,o,r){super(n);m(this,"status");m(this,"response");this.name="ScannerApiError",this.status=o,this.response=r}};async function c(t){if(!t.ok){let e=t.statusText,n;try{let o=await t.json();n=o,o&&typeof o.error=="string"&&(e=o.error)}catch{n=await t.text().catch(()=>"Unknown error")}throw new s(`Report request failed: ${e}`,t.status,n)}return t.json()}var u={async startScan(t){let e=await fetch(`${a}/v2/scanner/public/scan`,{method:"POST",headers:k,body:JSON.stringify({url:t,acceptAll:!1})});if(e.status===409){let o=await e.json().catch(()=>({}));throw new s("A scan is already in progress for this website. Please wait for it to complete.",409,o)}if(e.status!==201){let o=await e.text().catch(()=>"Unknown error");throw new s(`Expected 201 Created but got ${e.status}`,e.status,o)}return await c(e)},async getStatus(t){let e=await fetch(`${a}/v2/scanner/public/status/${t}`,{headers:y});return await c(e)},async getResults(t){let e=await fetch(`${a}/v2/scanner/public/results/${t}`,{headers:y});return await c(e)},async cancelScan(t){let e=await fetch(`${a}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:k});return await c(e)}},p=t=>{let e=t.trim();return!e.startsWith("http://")&&!e.startsWith("https://")&&(e="https://"+e),e};var b="[Scan]",h="Please enter a valid URL (e.g. https://example.com).",C="Failed to start scan. Please try again.",T="/result",w=()=>{let t=i("scan-form"),e=i("scan-url-input"),n=i("scan-submit"),o=i("form-error"),r=i("form-error-text");return!t||!e||!n||!o||!r?(console.error(`${b} Missing elements:`,{form:!!t,urlInput:!!e,submitButton:!!n,errorDiv:!!o,errorText:!!r}),null):{form:t,urlInput:e,submitButton:n,errorDiv:o,errorText:r}},d=(t,e)=>{t.errorText.innerHTML=e,t.errorDiv.style.display="flex"},R=t=>{t.errorDiv.style.display="none",t.errorText.innerHTML=""},D=(t,e)=>{let n=t.value.trim();if(!n)return d(e,h),null;let o=f(n);return o||(d(e,h),null)},M=t=>{let e=t.dataset.wait;e&&(t.value=e)},L=(t,e)=>{t.value=e,t.disabled=!1},A=t=>`${t.origin}${t.pathname}`,H=async(t,e,n)=>{try{let o=await u.startScan(A(t));if(!o.trackingId)throw new Error("No tracking ID returned");let r=new URL(T,window.location.origin);r.searchParams.set("trid",o.trackingId),r.searchParams.set("site",t.hostname),window.location.href=r.href}catch(o){if(console.error(`${b} Scan failed:`,o),o instanceof s&&o.status===409){let g=o.response?.trackingId;if(g){let l=new URL(T,window.location.origin);l.searchParams.set("trid",g),l.searchParams.set("site",t.hostname),window.location.href=l.href;return}}let r=o instanceof s?`Scan failed: ${o.message}`:C;d(e,r),L(e.submitButton,n)}},P=async(t,e)=>{t.preventDefault(),t.stopPropagation(),R(e);let n=D(e.urlInput,e);if(!n)return;e.urlInput.value=n.href;let o=e.submitButton.value||"Scan";M(e.submitButton),e.submitButton.disabled=!0,await H(n,e,o)},z=()=>{let t=w();t&&t.form.addEventListener("submit",e=>P(e,t),{capture:!0})};window.Webflow||(window.Webflow=[]);window.Webflow.push(z);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finsweet/consentpro-scan",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
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",