PageSourceSearch

https://flagged.org.uk/assets/scan-DlstzD9j.js

js flagged.org.uk collected 2026-10-09 22:03:08 UTC 5,625 bytes, 1 lines download raw bytes

1import{c as k,r as i,b as y,f as C,j as e,L as w}from"./index-CGoK7lUl.js";import{u as N}from"./useMutation-Dc1KGT6p.js";import{s as E,p as P}from"./scan.functions-B82nzzXM.js";import{n as M}from"./url-utils-Cspc0WWi.js";import{r as I,c as S}from"./scan-cache-C5-u69uP.js";import{u as L}from"./useSessionReady-D9WGhvsd.js";import{u as R}from"./useCurrentPlan-BwVuX4_M.js";import{c as F}from"./useSubscription-CBxZm-OZ.js";import{t as l}from"./index-Bheba9Kn.js";import{S as q}from"./ScanResult-BVbiqtbT.js";import{S as D}from"./ScanProgress-Dv_UNJ43.js";import{e as U}from"./monitoring.functions-B5W9iTev.js";import{B as _}from"./bell-LqA8KG0_.js";import{S as v}from"./sparkles-CansNi9S.js";import{L as B}from"./loader-circle-Bt1jUd0f.js";import{S as O}from"./search-Dem0Q2VU.js";import"./stripe-or877oiw.js";import"./scan-pdf-DzPLU6AZ.js";import"./info-io-tsOwm.js";import"./circle-check-JY4KZ_SM.js";import"./circle-x-C3Pl_h1u.js";const W=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],z=k("bell-off",W),j=t=>`flagged:monitor-prompt:${t}`;function G(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function K({url:t,scanId:u,score:m,findings:f,websiteId:c,plan:d}){const[o,p]=i.useState(()=>typeof window>"u"?!1:localStorage.getItem(j(t))==="1"),[h,x]=i.useState(!1),b=y(U),g=C(),a=N({mutationFn:()=>b({data:{url:t,scanId:u,score:m,findings:f,websiteId:c}}),onSuccess:n=>{if(n&&"ok"in n&&!n.ok){l.error(n.message);return}l.success("Monitoring enabled."),x(!0),g.invalidateQueries({queryKey:["monitored-sites"]})},onError:n=>l.error(n instanceof Error?n.message:"Could not enable")});if(o||h||d==="free")return null;const s=()=>{typeof window<"u"&&localStorage.setItem(j(t),"1"),p(!0)},r=d==="pro"?"weekly":"monthly";return e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-4 rounded-xl border border-border bg-surface p-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-accent/15 text-accent",children:e.jsx(_,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:["Enable monitoring for ",G(t),"?"]}),e.jsxs("p",{className:"mt-0.5 text-sm text-muted-foreground",children:["We'll re-scan it ",r," and email you if anything changes."]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:s,className:"inline-flex h-9 items-center gap-1.5 rounded-md border border-input px-3 text-sm hover:bg-secondary",children:[e.jsx(z,{className:"h-3.5 w-3.5"})," Not now"]}),e.jsxs("button",{onClick:()=>a.mutate(),disabled:a.isPending,className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-60",children:[e.jsx(v,{className:"h-3.5 w-3.5"})," ",a.isPending?"Enabling…":"Enable monitoring"]})]}),e.jsx(w,{to:"/monitoring",className:"text-xs text-muted-foreground underline-offset-4 hover:underline",children:"Manage all monitored sites"})]})}function le(){const t=y(E),u=y(P),m=L(),{plan:f}=R(),[c,d]=i.useState(""),[o,p]=i.useState(null),[h,x]=i.useState(void 0),[b,g]=i.useState(void 0);i.useEffect(()=>{if(!m||o)return;const s=I();s&&(d(s.url),p(s.result),(async()=>{try{const n=await u({data:{url:s.url,score:s.result.score,findings:s.result.findings,trackers:s.result.trackers,recommendations:s.result.recommendations}});x(n.id),g(n.website_id),S()}catch{}})())},[m,o,u]);const a=N({mutationFn:s=>t({data:{url:s}}),onSuccess:s=>{const r=s;p(r),x(r.id),g(r.website_id),S()},onError:s=>l.error(s instanceof Error?s.message:"Scan failed")});return e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-4xl",children:"Scan a website"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Free, unlimited compliance scans — score, gap report and tracker detection."}),!F(f)&&e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-4 roun
1ded-lg border border-dashed border-border bg-surface/50 px-4 py-2.5 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Scanning is free. Generating the legal documents to fix the gaps is on Starter & Pro."}),e.jsxs(w,{to:"/pricing",className:"inline-flex items-center gap-1 text-xs font-medium hover:underline",children:[e.jsx(v,{className:"h-3 w-3"})," See pricing"]})]}),e.jsxs("form",{noValidate:!0,onSubmit:s=>{s.preventDefault();const r=M(c);if(!r){l.error("Enter a website URL");return}d(r),a.mutate(r)},className:"mt-6 flex gap-2 rounded-xl border border-border bg-surface p-3",children:[e.jsx("input",{type:"text",inputMode:"url",autoComplete:"url",value:c,onChange:s=>d(s.target.value),placeholder:"e.g. yourwebsite.co.uk",className:"h-11 flex-1 rounded-md border border-input bg-background px-3 text-sm"}),e.jsxs("button",{type:"submit",disabled:a.isPending||!m,className:"inline-flex h-11 items-center gap-2 rounded-md bg-primary px-5 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-60",children:[a.isPending?e.jsx(B,{className:"h-4 w-4 animate-spin"}):e.jsx(O,{className:"h-4 w-4"}),a.isPending?"Scanning…":"Scan now"]})]}),e.jsx(D,{active:a.isPending}),o&&e.jsxs("div",{className:"mt-8",children:[e.jsx(q,{result:o,url:c}),e.jsx(K,{url:c,scanId:h,score:o.score,findings:o.findings,websiteId:b,plan:f})]})]})}export{le as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.