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