@finsweet/consentpro-scan 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/results.js +1 -1
- package/dist/scan.js +1 -1
- package/package.json +1 -1
package/dist/results.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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:a}=o.getState().ixSession,r=Object.entries(a);t||n.destroy(),n.init(),await Promise.all(r.map(l=>o.dispatch(s.eventStateChanged(...l))))}}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",Me=["essential","necessary"],w=t=>!!t&&Me.includes(t),Ae=/googletagmanager\.com\/gtm\.js\?(?:[^"'#\s]*&)?id=(GTM-[A-Z0-9]+)/gi,Z=t=>t.type!=="script"?!1:Ae.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"),He=t=>t.filter(e=>e.type==="noscript"),Pe=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)),M=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:He,unblockedDOMResources:Pe,unblockedScripts:$e,storageResources:M,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(c=>c.status==="pass").length,failed:e.filter(c=>c.status==="fail").length,warnings:e.filter(c=>c.status==="warning").length,notVerifiable:e.filter(c=>c.status==="not-verifiable").length},o=e.filter(c=>c.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"],a=0,r=0;for(let c of o){let m=1;c.id==="pre-consent-trackers"?m=3:s.includes(c.id)&&(m=2);let f=c.status==="pass"?1:c.status==="warning"?.5:0;a+=f*m,r+=m}return{overallScore:Math.round(a/r*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(f=>o.set(f.id,f.name));let s=O(e),a=_(e).length,r=F(e).length,l=[...new Set(s.map(f=>o.get(f.providerId)||f.name||f.domain||f.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 c=[];a>0&&c.push(`${a} analytics`),r>0&&c.push(`${r} marketing`);let m=s.length-a-r;return m>0&&c.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 (${c.join(", ")}). These should be blocked until user provides consent.`,affectedItems:l}}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(a=>a.version?`${a.name} (v${a.version})`:a.name).join(", ")}`};let e=[],n=new Map;for(let s of je){let a=0;if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let r of t.detectedItems)if(x(r)&&r.type==="script"){let{source:l}=r,c=r.element?.outerHTML||"";for(let m of s.patterns.scripts)if(m.test(l)||m.test(c)){a+=1,e.includes(r.id)||e.push(r.id);break}}}if(t.trackersInfo?.providers&&Array.isArray(t.trackersInfo.providers))for(let r of t.trackersInfo.providers){let l=r.name||"";for(let c of s.patterns.scripts)if(c.test(l)){a+=1,e.includes(r.id)||e.push(r.id);break}}if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let r of t.detectedItems)if(I(r)&&r.type==="cookie"){let{name:l}=r;for(let c of s.patterns.cookies)if(c.test(l)){a+=1,e.includes(r.id)||e.push(r.id);break}}}if(t.detectedItems&&Array.isArray(t.detectedItems))for(let r of t.detectedItems){let c=x(r)&&r.element?.outerHTML||"";for(let m of s.patterns.dom)if(m.test(c)){a+=1,e.includes(r.id)||e.push(r.id);break}}a>0&&n.set(s.name,a)}let o=Array.from(n.entries()).sort((s,a)=>a[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??"",a=o.source??"";return!(le.test(s)||le.test(a))}),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(c=>x(c)&&c.type==="script"&&Ge.test(c.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(c=>I(c)&&c.type==="cookie"&&ne.test(c.name)),a=e.filter(c=>I(c)&&c.type==="session-storage"&&ne.test(c.name)),r=e.filter(c=>I(c)&&c.type==="local-storage"&&ne.test(c.name)),l=[];if(s.length>0&&l.push(`${s.length} cookie(s)`),a.length>0&&l.push(`${a.length} session-storage key(s)`),r.length>0&&l.push(`${r.length} local-storage key(s)`),l.length>0){let c=[...s.map(m=>m.id),...a.map(m=>m.id),...r.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: ${l.join(", ")}.`,affectedItems:c}}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??[],a=M(s),r=new Map;o.forEach(y=>r.set(y.id,y.name));let l=O(n),c=_(n),m=F(n);if(c.length>0){let y=oe(c,3,r);e.push(`${c.length} analytics tracker(s) running before consent: ${y}`)}if(m.length>0){let y=oe(m,3,r);e.push(`${m.length} marketing tracker(s) firing before consent: ${y}`)}let f=l.filter(y=>y.category!=="analytics"&&y.category!=="marketing");if(f.length>0){let y=oe(f,3,r);e.push(`${f.length} other tracker(s) need consent: ${y}`)}let k=N(a);k.length>0&&e.push(`${k.length} non-essential cookies set before consent`);let u=U(a);u.length>0&&e.push(`${u.length} uncategorized cookies detected - review and categorize`);let d=J(a),g=ee(a),v=d.length+g.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",H=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 fe(t){let e=V(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function ge(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=M(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,storageCount:M(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:fe(t),actionableItems:ge(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:fe,extractActionableItems:ge,extractViolations:ye,extractDetectedItems:he,extractComplianceSummary:ke,extractAttentionItems:ve,extractStatistics:Ce,extractFullCompliance:et,extractAll:tt};var be="data-fs-cs";var i=(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(`${H}/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(`${H}/v2/scanner/public/status/${t}`,{headers:Ee});return await j(e)},async getResults(t){let e=await fetch(`${H}/v2/scanner/public/results/${t}`,{headers:Ee});return await j(e)},async cancelScan(t){let e=await fetch(`${H}/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},ft=(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},D=(t,e,n)=>{let o=ft(e,n),s=document.createElement("template");s.innerHTML=o.trim();let a=s.content.firstElementChild;if(!a)return null;if(a.setAttribute("data-fs-icon",e),n?.size&&(a.style.setProperty("width",`${n.size}px`,"important"),a.style.setProperty("height",`${n.size}px`,"important")),t.className){let r=a.getAttribute("class")||"";a.setAttribute("class",`${r} ${t.className}`.trim())}return t.replaceWith(a),a};var gt=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=i("current-scan-activity");e&&(e.textContent=t,console.log(`[Results] Current scan activity: ${t}`))},kt=(t,e)=>{let n=i("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=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"),n=i("scan-error-container"),o=i("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:a,totalPages:r}=s.progress;kt(a,r)}if(s.status==="completed")clearInterval(o),e();else if(s.status==="failed"){let a=s.error||"Scan failed unexpectedly";console.error("[Results] Scan failed:",a),q(`Scan failed: ${a}`),clearInterval(o),n(new Error(a))}}catch(s){console.error("[Results] Error polling status:",s),q("Unable to check scan status. Please try again."),clearInterval(o),n(s)}},gt)})),bt=()=>{let t=i("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{pagesScanned:e,origin:n}=t.results,o=e.length>0?e[0]:n;A("target-website").forEach(r=>{r.textContent=o}),A("target-website-url").forEach(r=>{r instanceof HTMLAnchorElement?r.href=o:r.textContent=o})},Tt=t=>{let e=T.extractFullCompliance(t),n=i("compliance-score");if(n){let o=i("value",n);if(o){let s=Math.round(e.overallScore);o.textContent=`${s}%`;let a;s>=80?a=h["success-foreground"]:s>=50?a=h["warning-foreground"]:a=h["error-foreground"],o.style.color=a}}},It=t=>{A("target-website").forEach(o=>{o.textContent=t}),A("target-website-url").forEach(o=>{o instanceof HTMLAnchorElement?o.href=t:o.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=i(t);if(!s)return;let a=i("value",s),r=i("text",s);a&&(a.textContent=e),r&&n&&(r.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))},Mt=t=>{if(!t.results)return;let{detectedItems:e,trackersInfo:n}=t.results,o=S.unblockedScripts(e).length,s=S.unblockedCookies(e).length,r=S.violatingTrackers(n?.trackers??[]).length,l=o+s+r,{cmpInstalled:c}=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",l.toString(),"Violations",l===0?"success":"error"),At(!!c)},At=t=>{let e=i("cmp-status-card");if(!e)return;let n=i("icon",e),o=i("text",e),s=t?h["success-foreground"]:h["error-foreground"];n&&D(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),a=!!s,r=S.unblockedScripts(e).length,l=S.unblockedCookies(e).length,m=S.violatingTrackers(n?.trackers??[]).length,f=r+l+m,k;a?f===0?k="compliant":f<=2?k="partial":k="non-compliant":k="non-compliant";let u=()=>{if(!a)return"No Consent Management Platform detected. CMP is required for privacy compliance.";if(f===0)return"No pre-consent violations detected. Nice work!";let p=[];return r>0&&p.push(`${r} script${r>1?"s":""} to fix`),l>0&&p.push(`${l} cookie${l>1?"s":""} to fix`),m>0&&p.push(`${m} tracker issue${m>1?"s":""}`),k==="partial"?`Found ${p.join(", ")}. Let's get you compliant.`:`Major compliance gaps: ${p.join(", ")}. Action needed ASAP.`},g={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=i("compliance-status",v);if(y){let p=i("icon",y),b=i("text",y);p&&D(p,g.icon,{color:g.iconColor,size:30}),b&&(b.textContent=g.label)}let E=i("compliance-details",v);E&&(E.textContent=g.message);let C=i("violations-wrapper",v);if(C){let p=i("value",C);p&&(p.textContent=f.toString())}v.style.backgroundColor=g.color},zt=t=>{if(!t.results)return;let{trackersInfo:e}=t.results,n=i("violations-component"),o=i("violations-list"),s=i("violation-template");if(!o||!s)return;let a=S.violatingTrackers(e?.trackers??[]);if(n){let u=i("icon",n);u&&D(u,"alert-octagon",{color:h["error-foreground"],size:24})}Array.from(o.children).forEach(u=>{u!==s&&u.remove()}),s.style.display="none";let l=i("violations-list-empty");if(a.length===0){l&&(l.removeAttribute("fs-cloak"),l.classList.remove("hide")),o.setAttribute("fs-cloak",""),o.classList.add("hide");return}l&&(l.setAttribute("fs-cloak",""),l.classList.add("hide")),o.removeAttribute("fs-cloak"),o.classList.remove("hide");let c=e?.providers??[],m=new Map;c.forEach(u=>m.set(u.id,u.name));let f={analytics:"\u{1F4CA}",marketing:"\u{1F4E2}",advertising:"\u{1F4FA}",functional:"\u2699\uFE0F",uncategorized:"\u2753"},k=new Set;a.forEach(u=>{let g=m.get(u.providerId)||u.name||u.domain||u.providerId||"Unknown",v=`${u.category}-${g}`;if(k.has(v))return;k.add(v);let y=s.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let E=i("icon",y);E&&D(E,"chevron-right",{color:h["error-foreground"],size:16});let C=i("text",y);if(C){let p=f[u.category]??"\u{1F534}",b=u.category||"uncategorized";C.textContent=`${p} ${g}: ${b} tracker running before consent`}o.appendChild(y)})},Ht=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"]},P=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(P(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=Ht(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},Pt=t=>{let e=T.extractDetectedItems(t),n=[...e.dom].filter(u=>!S.isEssentialCategory(u.category)).sort((u,d)=>P(u.category)-P(d.category)),o=[...e.storage].filter(u=>!S.isEssentialCategory(u.category)).sort((u,d)=>P(u.category)-P(d.category)),s=i("scripts-component"),a=i("script-list"),r=i("script-item"),l=i("script-list-empty");if(a&&r){if(s){let d=i("scripts-title",s);d&&(d.textContent=`Detected DOM Resources (${n.length})`)}Array.from(a.children).forEach(d=>{d!==r&&d.remove()}),r.style.display="none",n.length===0?(l&&(l.removeAttribute("fs-cloak"),l.classList.remove("hide")),a.setAttribute("fs-cloak",""),a.classList.add("hide")):(l&&(l.setAttribute("fs-cloak",""),l.classList.add("hide")),a.removeAttribute("fs-cloak"),a.classList.remove("hide"),n.forEach(d=>{let g=r.cloneNode(!0);g.removeAttribute("data-fs-cs"),g.style.display="";let v=i("script-title",g),y=i("script-url",g),E=i("script-type",g),C=i("script-tag",g),p=i("icon",g);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"),C){let b=d.category||"uncategorized";C.textContent=b,C.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),C.classList.add(`is-${b}`),b==="uncategorized"&&(C.style.backgroundColor="#8f0c3d",C.style.color="#ffffff")}if(p){let b=d.category||"uncategorized",z=Ie(b);z?(p.style.display="",p.style.filter=z,p.title=Te(b)):p.style.display="none"}a.appendChild(g)}))}let c=i("cookies-component"),m=i("cookie-list"),f=i("cookie-item"),k=i("cookie-list-empty");if(m&&f){if(c){let d=i("cookies-title",c);d&&(d.textContent=`Cookies & Storage Data (${o.length})`)}Array.from(m.children).forEach(d=>{d!==f&&d.remove()}),f.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 g=f.cloneNode(!0);g.removeAttribute("data-fs-cs"),g.style.display="";let v=i("cookie-name",g),y=i("cookie-url",g),E=i("cookie-type",g),C=i("cookie-tag",g),p=i("icon",g);if(v&&(v.textContent=`${d.name||`Unknown ${d.type}`}`),y&&(y.textContent=d.domain||"N/A"),E&&(E.textContent=d.type||"N/A"),C){let b=d.category||"uncategorized";C.textContent=b,C.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),C.classList.add(`is-${b}`),b==="uncategorized"&&(C.style.backgroundColor="#8f0c3d",C.style.color="#ffffff")}if(p){let b=d.category||"uncategorized",z=Ie(b);z?(p.style.display="",p.style.filter=z,p.title=Te(b)):p.style.display="none"}m.appendChild(g)}))}},$t=t=>{let e=T.extractAttentionItems(t),n=i("attention-list"),o=i("attention-item"),s=i("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((a,r)=>{let l=o.cloneNode(!0);l.removeAttribute("data-fs-cs"),l.style.display="";let c=i("value",l);c&&(c.textContent=(r+1).toString());let m=i("text",l);m&&(m.textContent=a),n.appendChild(l)})}},Nt=t=>{let e=T.extractComplianceSummary(t),n=i("passed-items");if(n){let r=i("value",n);r&&(r.textContent=e.pass.toString())}let o=i("failed-items");if(o){let r=i("value",o);r&&(r.textContent=e.fail.toString())}let s=i("warning-items");if(s){let r=i("value",s);r&&(r.textContent=e.warn.toString())}let a=i("unverified-items");if(a){let r=i("value",a);r&&(r.textContent=e.unverified.toString())}},Ut=t=>{let e=T.extractFullCompliance(t),n=i("criteria-list"),o=i("criteria-item");if(!n||!o)return;Array.from(n.children).forEach(r=>{r!==o&&r.remove()}),o.style.display="none",e.criteria.filter(r=>r.status!=="not-verifiable").forEach(r=>{let l=o.cloneNode(!0);l.removeAttribute("data-fs-cs"),l.style.display="";let c=Se[r.status]||Se["not-verifiable"],m=i("icon",l);m&&D(m,c.icon,{color:c.color,size:24});let f=i("criteria-title",l),k=i("criteria-description",l);f&&(f.textContent=r.name),k&&(k.textContent=r.description);let u=i("criteria-status",l);u&&(u.textContent=c.label);let d=i("criteria-answer",l);d&&(d.textContent=r.details||"No additional details available."),n.appendChild(l)})},Ot=t=>{let e=T.extractStatistics(t),n=i("stat-duration");if(n){let c=i("value",n);c&&(c.textContent=e.scanDuration)}let o=i("stat-resources");if(o){let c=i("value",o);c&&(c.textContent=e.resourcesCount.toString())}let s=i("stat-storage");if(s){let c=i("value",s);c&&(c.textContent=e.storageCount.toString())}let a=i("stat-first-party");if(a){let c=i("value",a);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 l=i("stat-categories");if(l){let c=i("value",l);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:Mt},{name:"complianceContainer",updater:Dt,requiredElements:["compliance-container"]},{name:"violationsList",updater:zt,requiredElements:["violations-list"]},{name:"detectedItems",updater:Pt},{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(a=>!i(a)))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}let e;try{e=t.site}catch{e=`https://${t.site}`}It(e);try{await Ct(t.trackingId);let n=await Et(t.trackingId);console.log("[Results] Fetched results:",n);let o=xt(n);if(o){q(o);return}Ft(n),bt()}catch(n){console.error("[Results] Error during scan:",n);let o="An error occurred. Please try again.";n instanceof R&&n.response&&typeof n.response=="object"&&"error"in n.response?o=n.response.error:n instanceof Error&&(o=n.message),q(o)}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{Vt()});})();
|
|
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:i}=o.getState().ixSession,r=Object.entries(i);t||n.destroy(),n.init(),await Promise.all(r.map(l=>o.dispatch(s.eventStateChanged(...l))))}}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 b=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",Me=["essential","necessary"],w=t=>!!t&&Me.includes(t),Ae=/googletagmanager\.com\/gtm\.js\?(?:[^"'#\s]*&)?id=(GTM-[A-Z0-9]+)/gi,Z=t=>t.type!=="script"?!1:Ae.test(t.source),K=t=>t.filter(b),X=t=>t.filter(e=>e.type==="script"),De=t=>t.filter(e=>e.type==="iframe"),ze=t=>t.filter(e=>e.type==="link"),He=t=>t.filter(e=>e.type==="noscript"),Pe=t=>t.filter(e=>b(e)&&e.isThirdParty&&!w(e.category)&&!Z(e)),$e=t=>t.filter(e=>e.type==="script"&&e.isThirdParty&&!w(e.category)&&!Z(e)),M=t=>t.filter(I),Q=t=>t.filter(e=>e.type==="cookie"),Ne=t=>t.filter(e=>e.type==="local-storage"),Oe=t=>t.filter(e=>e.type==="session-storage"),Ue=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)),O=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),U=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"),je=t=>t.filter(e=>!e.category||e.category==="uncategorized"),S={isEssentialCategory:w,isResourceItem:b,isStorageItem:I,isBannerItem:Le,isGTMContainerScript:Z,isGTMContainerTracker:te,domResources:K,scripts:X,iframes:De,links:ze,noscripts:He,loadedDOMResources:Pe,loadedScripts:$e,storageResources:M,cookies:Q,localStorage:Ne,sessionStorage:Oe,loadedStorageResources:Ue,loadedCookies:N,loadedLocalStorage:J,loadedSessionStorage:ee,uncategorizedCookies:O,violatingTrackers:U,trackersByCategory:Fe,analyticsTrackers:_,marketingTrackers:F,uncategorizedTrackers:je};var Ve=[{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(c=>c.status==="pass").length,failed:e.filter(c=>c.status==="fail").length,warnings:e.filter(c=>c.status==="warning").length,notVerifiable:e.filter(c=>c.status==="not-verifiable").length},o=e.filter(c=>c.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"],i=0,r=0;for(let c of o){let m=1;c.id==="pre-consent-trackers"?m=3:s.includes(c.id)&&(m=2);let f=c.status==="pass"?1:c.status==="warning"?.5:0;i+=f*m,r+=m}return{overallScore:Math.round(i/r*100),hasViolations:n.failed>0,criteria:e,summary:n}}function j(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(f=>o.set(f.id,f.name));let s=U(e),i=_(e).length,r=F(e).length,l=[...new Set(s.map(f=>o.get(f.providerId)||f.name||f.domain||f.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 c=[];i>0&&c.push(`${i} analytics`),r>0&&c.push(`${r} marketing`);let m=s.length-i-r;return m>0&&c.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 (${c.join(", ")}). These should be blocked until user provides consent.`,affectedItems:l}}function Be(t){let e=t.detectedItems.filter(b).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(b).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(b).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(i=>i.version?`${i.name} (v${i.version})`:i.name).join(", ")}`};let e=[],n=new Map;for(let s of Ve){let i=0;if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let r of t.detectedItems)if(b(r)&&r.type==="script"){let{source:l}=r,c=r.element?.outerHTML||"";for(let m of s.patterns.scripts)if(m.test(l)||m.test(c)){i+=1,e.includes(r.id)||e.push(r.id);break}}}if(t.trackersInfo?.providers&&Array.isArray(t.trackersInfo.providers))for(let r of t.trackersInfo.providers){let l=r.name||"";for(let c of s.patterns.scripts)if(c.test(l)){i+=1,e.includes(r.id)||e.push(r.id);break}}if(t.detectedItems&&Array.isArray(t.detectedItems)){for(let r of t.detectedItems)if(I(r)&&r.type==="cookie"){let{name:l}=r;for(let c of s.patterns.cookies)if(c.test(l)){i+=1,e.includes(r.id)||e.push(r.id);break}}}if(t.detectedItems&&Array.isArray(t.detectedItems))for(let r of t.detectedItems){let c=b(r)&&r.element?.outerHTML||"";for(let m of s.patterns.dom)if(m.test(c)){i+=1,e.includes(r.id)||e.push(r.id);break}}i>0&&n.set(s.name,i)}let o=Array.from(n.entries()).sort((s,i)=>i[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(!b(o)||o.category!=="uncategorized"||!o.isThirdParty)return!1;let s=o.domain??"",i=o.source??"";return!(le.test(s)||le.test(i))}),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=O(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(c=>b(c)&&c.type==="script"&&Ge.test(c.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(c=>I(c)&&c.type==="cookie"&&ne.test(c.name)),i=e.filter(c=>I(c)&&c.type==="session-storage"&&ne.test(c.name)),r=e.filter(c=>I(c)&&c.type==="local-storage"&&ne.test(c.name)),l=[];if(s.length>0&&l.push(`${s.length} cookie(s)`),i.length>0&&l.push(`${i.length} session-storage key(s)`),r.length>0&&l.push(`${r.length} local-storage key(s)`),l.length>0){let c=[...s.map(m=>m.id),...i.map(m=>m.id),...r.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: ${l.join(", ")}.`,affectedItems:c}}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??[],i=M(s),r=new Map;o.forEach(y=>r.set(y.id,y.name));let l=U(n),c=_(n),m=F(n);if(c.length>0){let y=oe(c,3,r);e.push(`${c.length} analytics tracker(s) running before consent: ${y}`)}if(m.length>0){let y=oe(m,3,r);e.push(`${m.length} marketing tracker(s) firing before consent: ${y}`)}let f=l.filter(y=>y.category!=="analytics"&&y.category!=="marketing");if(f.length>0){let y=oe(f,3,r);e.push(`${f.length} other tracker(s) need consent: ${y}`)}let k=N(i);k.length>0&&e.push(`${k.length} non-essential cookies set before consent`);let u=O(i);u.length>0&&e.push(`${u.length} uncategorized cookies detected - review and categorize`);let d=J(i),g=ee(i),v=d.length+g.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",H=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 fe(t){let e=j(t);return{compliant:!e.hasViolations,score:e.overallScore,violations:e.summary.failed}}function ge(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=M(e.detectedItems);return{dom:n,storage:o}}function ke(t){let e=j(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,storageCount:M(e.detectedItems).length,firstParty:e.statistics?.firstPartyResources??0,thirdParty:e.statistics?.thirdPartyResources??0,categories:Object.keys(e.statistics?.categoryCounts||{}).length}}function et(t){return j(t)}function tt(t){return{scanSummary:pe(t),compliance:fe(t),actionableItems:ge(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:fe,extractActionableItems:ge,extractViolations:ye,extractDetectedItems:he,extractComplianceSummary:ke,extractAttentionItems:ve,extractStatistics:Ce,extractFullCompliance:et,extractAll:tt};var Ee="data-fs-cs";var a=(t,e=document)=>e.querySelector(`[${Ee}="${t}"]`),A=(t,e=document)=>e.querySelectorAll(`[${Ee}="${t}"]`);var xe={"X-Finsweet-ConsentPro-Version":"v2"},be={"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 V(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(`${H}/v2/scanner/public/scan`,{method:"POST",headers:be,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 V(e)},async getStatus(t){let e=await fetch(`${H}/v2/scanner/public/status/${t}`,{headers:xe});return await V(e)},async getResults(t){let e=await fetch(`${H}/v2/scanner/public/results/${t}`,{headers:xe});return await V(e)},async cancelScan(t){let e=await fetch(`${H}/v2/scanner/public/scan/${t}`,{method:"DELETE",headers:be});return await V(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},ft=(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},D=(t,e,n)=>{let o=ft(e,n),s=document.createElement("template");s.innerHTML=o.trim();let i=s.content.firstElementChild;if(!i)return null;if(i.setAttribute("data-fs-icon",e),n?.size&&(i.style.setProperty("width",`${n.size}px`,"important"),i.style.setProperty("height",`${n.size}px`,"important")),t.className){let r=i.getAttribute("class")||"";i.setAttribute("class",`${r} ${t.className}`.trim())}return t.replaceWith(i),i};var gt=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:i,totalPages:r}=s.progress;kt(i,r)}if(s.status==="completed")clearInterval(o),e();else if(s.status==="failed"){let i=s.error||"Scan failed unexpectedly";console.error("[Results] Scan failed:",i),q(`Scan failed: ${i}`),clearInterval(o),n(new Error(i))}}catch(s){console.error("[Results] Error polling status:",s),q("Unable to check scan status. Please try again."),clearInterval(o),n(s)}},gt)})),Et=()=>{let t=a("scan-status_style");t&&t.remove()},xt=async t=>G.getResults(t),bt=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{pagesScanned:e,origin:n}=t.results,o=e.length>0?e[0]:n;A("target-website").forEach(r=>{r.textContent=o}),A("target-website-url").forEach(r=>{r instanceof HTMLAnchorElement?r.href=o:r.textContent=o})},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 i;s>=80?i=h["success-foreground"]:s>=50?i=h["warning-foreground"]:i=h["error-foreground"],o.style.color=i}}},It=t=>{A("target-website").forEach(o=>{o.textContent=t}),A("target-website-url").forEach(o=>{o instanceof HTMLAnchorElement?o.href=t:o.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 i=a("value",s),r=a("text",s);i&&(i.textContent=e),r&&n&&(r.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))},Mt=t=>{if(!t.results)return;let{detectedItems:e}=t.results,n=S.loadedScripts(e).length,o=S.loadedCookies(e).length,s=n+o,{cmpInstalled:i}=T.extractActionableItems(t);L("scripts-detected-card",n.toString(),void 0,n===0?"success":"error"),L("cookies-detected-card",o.toString(),void 0,o===0?"success":"warning"),L("action-items-card",s.toString(),"Violations",s===0?"success":"error"),At(!!i)},At=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&&D(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),i=!!s,r=S.domResources(e).filter(p=>!S.isEssentialCategory(p.category)).length,l=S.loadedStorageResources(e).length,m=S.violatingTrackers(n?.trackers??[]).length,f=r+l,k;i?f===0?k="compliant":f<=2?k="partial":k="non-compliant":k="non-compliant";let u=()=>{if(!i)return"No Consent Management Platform detected. CMP is required for privacy compliance.";if(f===0)return"No pre-consent violations detected. Nice work!";let p=[];return r>0&&p.push(`${r} resource${r>1?"s":""} to fix`),l>0&&p.push(`${l} storage item${l>1?"s":""} to fix`),m>0&&p.push(`${m} tracker issue${m>1?"s":""}`),k==="partial"?`Found ${p.join(", ")}. Let's get you compliant.`:`Major compliance gaps: ${p.join(", ")}. Action needed ASAP.`},g={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),E=a("text",y);p&&D(p,g.icon,{color:g.iconColor,size:30}),E&&(E.textContent=g.label)}let x=a("compliance-details",v);x&&(x.textContent=g.message);let C=a("violations-wrapper",v);if(C){let p=a("value",C);p&&(p.textContent=f.toString())}v.style.backgroundColor=g.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 i=S.violatingTrackers(e?.trackers??[]);if(n){let u=a("icon",n);u&&D(u,"alert-octagon",{color:h["error-foreground"],size:24})}Array.from(o.children).forEach(u=>{u!==s&&u.remove()}),s.style.display="none";let l=a("violations-list-empty");if(i.length===0){l&&(l.removeAttribute("fs-cloak"),l.classList.remove("hide")),o.setAttribute("fs-cloak",""),o.classList.add("hide");return}l&&(l.setAttribute("fs-cloak",""),l.classList.add("hide")),o.removeAttribute("fs-cloak"),o.classList.remove("hide");let c=e?.providers??[],m=new Map;c.forEach(u=>m.set(u.id,u.name));let f={analytics:"\u{1F4CA}",marketing:"\u{1F4E2}",advertising:"\u{1F4FA}",functional:"\u2699\uFE0F",uncategorized:"\u2753"},k=new Set;i.forEach(u=>{let g=m.get(u.providerId)||u.name||u.domain||u.providerId||"Unknown",v=`${u.category}-${g}`;if(k.has(v))return;k.add(v);let y=s.cloneNode(!0);y.removeAttribute("data-fs-cs"),y.style.display="";let x=a("icon",y);x&&D(x,"chevron-right",{color:h["error-foreground"],size:16});let C=a("text",y);if(C){let p=f[u.category]??"\u{1F534}",E=u.category||"uncategorized";C.textContent=`${p} ${g}: ${E} tracker running before consent`}o.appendChild(y)})},Ht=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"]},P=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(P(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=Ht(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},Pt=t=>{let e=T.extractDetectedItems(t),n=[...e.dom].filter(u=>!S.isEssentialCategory(u.category)).sort((u,d)=>P(u.category)-P(d.category)),o=[...e.storage].filter(u=>!S.isEssentialCategory(u.category)).sort((u,d)=>P(u.category)-P(d.category)),s=a("scripts-component"),i=a("script-list"),r=a("script-item"),l=a("script-list-empty");if(i&&r){if(s){let d=a("scripts-title",s);d&&(d.textContent=`Detected DOM Resources (${n.length})`)}Array.from(i.children).forEach(d=>{d!==r&&d.remove()}),r.style.display="none",n.length===0?(l&&(l.removeAttribute("fs-cloak"),l.classList.remove("hide")),i.setAttribute("fs-cloak",""),i.classList.add("hide")):(l&&(l.setAttribute("fs-cloak",""),l.classList.add("hide")),i.removeAttribute("fs-cloak"),i.classList.remove("hide"),n.forEach(d=>{let g=r.cloneNode(!0);g.removeAttribute("data-fs-cs"),g.style.display="";let v=a("script-title",g),y=a("script-url",g),x=a("script-type",g),C=a("script-tag",g),p=a("icon",g);if(v&&(v.textContent=`${d.domain||`Unknown ${d.type}`}`),y&&(y.textContent=d.source?.slice(0,100)||"N/A"),x&&(x.textContent=d.type||"N/A"),C){let E=d.category||"uncategorized";C.textContent=E,C.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),C.classList.add(`is-${E}`),E==="uncategorized"&&(C.style.backgroundColor="#8f0c3d",C.style.color="#ffffff")}if(p){let E=d.category||"uncategorized",z=Ie(E);z?(p.style.display="",p.style.filter=z,p.title=Te(E)):p.style.display="none"}i.appendChild(g)}))}let c=a("cookies-component"),m=a("cookie-list"),f=a("cookie-item"),k=a("cookie-list-empty");if(m&&f){if(c){let d=a("cookies-title",c);d&&(d.textContent=`Cookies & Storage Data (${o.length})`)}Array.from(m.children).forEach(d=>{d!==f&&d.remove()}),f.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 g=f.cloneNode(!0);g.removeAttribute("data-fs-cs"),g.style.display="";let v=a("cookie-name",g),y=a("cookie-url",g),x=a("cookie-type",g),C=a("cookie-tag",g),p=a("icon",g);if(v&&(v.textContent=`${d.name||`Unknown ${d.type}`}`),y&&(y.textContent=d.domain||"N/A"),x&&(x.textContent=d.type||"N/A"),C){let E=d.category||"uncategorized";C.textContent=E,C.classList.remove("is-marketing","is-analytics","is-advertising","is-uncategorized"),C.classList.add(`is-${E}`),E==="uncategorized"&&(C.style.backgroundColor="#8f0c3d",C.style.color="#ffffff")}if(p){let E=d.category||"uncategorized",z=Ie(E);z?(p.style.display="",p.style.filter=z,p.title=Te(E)):p.style.display="none"}m.appendChild(g)}))}},$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((i,r)=>{let l=o.cloneNode(!0);l.removeAttribute("data-fs-cs"),l.style.display="";let c=a("value",l);c&&(c.textContent=(r+1).toString());let m=a("text",l);m&&(m.textContent=i),n.appendChild(l)})}},Nt=t=>{let e=T.extractComplianceSummary(t),n=a("passed-items");if(n){let r=a("value",n);r&&(r.textContent=e.pass.toString())}let o=a("failed-items");if(o){let r=a("value",o);r&&(r.textContent=e.fail.toString())}let s=a("warning-items");if(s){let r=a("value",s);r&&(r.textContent=e.warn.toString())}let i=a("unverified-items");if(i){let r=a("value",i);r&&(r.textContent=e.unverified.toString())}},Ot=t=>{let e=T.extractFullCompliance(t),n=a("criteria-list"),o=a("criteria-item");if(!n||!o)return;Array.from(n.children).forEach(r=>{r!==o&&r.remove()}),o.style.display="none",e.criteria.filter(r=>r.status!=="not-verifiable").forEach(r=>{let l=o.cloneNode(!0);l.removeAttribute("data-fs-cs"),l.style.display="";let c=Se[r.status]||Se["not-verifiable"],m=a("icon",l);m&&D(m,c.icon,{color:c.color,size:24});let f=a("criteria-title",l),k=a("criteria-description",l);f&&(f.textContent=r.name),k&&(k.textContent=r.description);let u=a("criteria-status",l);u&&(u.textContent=c.label);let d=a("criteria-answer",l);d&&(d.textContent=r.details||"No additional details available."),n.appendChild(l)})},Ut=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-storage");if(s){let c=a("value",s);c&&(c.textContent=e.storageCount.toString())}let i=a("stat-first-party");if(i){let c=a("value",i);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 l=a("stat-categories");if(l){let c=a("value",l);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:Mt},{name:"complianceContainer",updater:Dt,requiredElements:["compliance-container"]},{name:"violationsList",updater:zt,requiredElements:["violations-list"]},{name:"detectedItems",updater:Pt},{name:"attentionItems",updater:$t,requiredElements:["attention-list"]},{name:"complianceSummary",updater:Nt},{name:"complianceCriteria",updater:Ot,requiredElements:["criteria-list"]},{name:"statistics",updater:Ut}],Ft=t=>{_t.forEach(({name:e,updater:n,requiredElements:o})=>{try{if(o&&o.find(i=>!a(i)))return;n(t)}catch(s){console.error(`[Results] Error in updater "${e}":`,s)}}),Y()},jt=async()=>{let t=yt();if(!t){console.error("[Results] Cannot fetch results without tracking ID");return}let e;try{e=t.site}catch{e=`https://${t.site}`}It(e);try{await Ct(t.trackingId);let n=await xt(t.trackingId);console.log("[Results] Fetched results:",n);let o=bt(n);if(o){q(o);return}Ft(n),Et()}catch(n){console.error("[Results] Error during scan:",n);let o="An error occurred. Please try again.";n instanceof R&&n.response&&typeof n.response=="object"&&"error"in n.response?o=n.response.error:n instanceof Error&&(o=n.message),q(o)}};window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{jt()});})();
|
package/dist/scan.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
1
|
+
"use strict";(()=>{var b=Object.defineProperty;var E=(t,e,n)=>e in t?b(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 x=localStorage.getItem("cs-dev")==="true",a=x?"https://fs-consentpro-api-dev.finsweet.workers.dev":"https://api.consentpro.com",Z=1440*60*1e3;var C="data-fs-cs";var i=(t,e=document)=>e.querySelector(`[${C}="${t}"]`);var y=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 k={"X-Finsweet-ConsentPro-Version":"v2"},h={"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:h,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:k});return await c(e)},async getResults(t){let e=await fetch(`${a}/v2/scanner/public/results/${t}`,{headers:k});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 I="[Scan]",T="Please enter a valid URL (e.g. https://example.com).",w="Failed to start scan. Please try again.",S="/result",R=()=>{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(`${I} Missing elements:`,{form:!!t,urlInput:!!e,submitButton:!!n,errorDiv:!!o,errorText:!!r}),null):{form:t,urlInput:e,submitButton:n,errorDiv:o,errorText:r}},g=(t,e)=>{t.errorText.innerHTML=e,t.errorDiv.style.display="flex"},D=t=>{t.errorDiv.style.display="none",t.errorText.innerHTML=""},L=(t,e)=>{let n=t.value.trim();if(!n)return g(e,T),null;let o=y(n);return o||(g(e,T),null)},M=t=>{let e=t.dataset.wait;e&&(t.value=e)},A=(t,e)=>{t.value=e,t.disabled=!1},d=t=>`${t.origin}${t.pathname}`,H=async(t,e,n)=>{try{let o=await u.startScan(d(t));if(!o.trackingId)throw new Error("No tracking ID returned");let r=new URL(S,window.location.origin);r.searchParams.set("trid",o.trackingId),r.searchParams.set("site",d(t)),window.location.href=r.href}catch(o){if(console.error(`${I} Scan failed:`,o),o instanceof s&&o.status===409){let f=o.response?.trackingId;if(f){let l=new URL(S,window.location.origin);l.searchParams.set("trid",f),l.searchParams.set("site",d(t)),window.location.href=l.href;return}}let r=o instanceof s?`Scan failed: ${o.message}`:w;g(e,r),A(e.submitButton,n)}},P=async(t,e)=>{t.preventDefault(),t.stopPropagation(),D(e);let n=L(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=R();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.
|
|
3
|
+
"version": "1.0.16",
|
|
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",
|