PageSourceSearch

https://compare-uk-quotes.replit.app/assets/section-CAUBVhJ-.js

js compare-uk-quotes.replit.app collected 2026-10-03 03:50:22 UTC 12,918 bytes, 1 lines download raw bytes

1import{a as o,j as e}from"./vendor-react-C74BMf_l.js";import{u as F,L as v}from"./vendor-router-BbFD896w.js";import{k as B,m as M,S as T,a2 as R,o as U,l as D,C as E,q as z,F as A,p as O,a3 as $}from"./index-CN_1Xir7.js";import{I as H}from"./input-BbdnErfN.js";import{m as q}from"./proxy-BKQpi-kA.js";import{L as Q}from"./loader-circle-9QsjUHYw.js";const K={insurance:{title:"Insurance Guides",desc:"Comprehensive UK insurance guides covering motor, home, life, travel, business and more — compare cover and find the policy that fits."},"money-saving":{title:"Money-Saving Tips",desc:"Practical UK money-saving advice to cut bills, lower borrowing costs and keep more cash in your pocket every month."},news:{title:"Latest News",desc:"Consumer alerts, regulatory updates and the latest UK insurance and money-saving news that affects your wallet."},"earn-money":{title:"Earn Money",desc:"UK guides on side hustles, savings tricks and ways to boost your income alongside your main earnings."},"insurance/motor":{title:"Car Insurance",desc:"Motor insurance guides for new drivers, classic cars, electric vehicles, no-claims bonuses and cutting your premium in the UK."},"insurance/home":{title:"Home Insurance",desc:"Home insurance guides covering buildings, contents, accidental damage, landlord cover and protecting your UK property."},"insurance/business":{title:"Business Insurance",desc:"UK business insurance explained — public liability, professional indemnity, employers' liability and choosing the right cover for your company."},"insurance/travel":{title:"Travel Insurance",desc:"Travel insurance guides covering single trip, annual multi-trip, medical conditions, winter sports and getting the right cover for any UK traveller."},"insurance/life":{title:"Life Insurance",desc:"Life insurance guides covering term, whole-of-life and over-50s plans — protect your family's finances if the worst happens."},"insurance/other":{title:"Other Insurance",desc:"Specialist UK insurance guides covering pet, gadget, mobile, breakdown cover and other niche policies."},"money-saving/credit-cards":{title:"Credit Cards",desc:"UK credit card guides on 0% balance transfers, rewards, cashback, building credit and choosing the right card for your spending."},"money-saving/loans":{title:"Loans",desc:"Personal loan guides on rates, eligibility, secured vs unsecured and how to borrow responsibly in the UK."},"money-saving/car-costs":{title:"Car Costs",desc:"Cut the cost of running a car in the UK — fuel, MOT, servicing, tax and finance tips that add up to real savings."},"money-saving/living-costs":{title:"Living Costs",desc:"Practical ways to lower the cost of everyday living in the UK — groceries, energy, broadband and family budgeting."},"money-saving/company-costs":{title:"Company Costs",desc:"Money-saving guides for UK businesses — overheads, suppliers, software and tax-efficient ways to keep more profit."},"money-saving/money-abroad":{title:"Money Abroad",desc:"How to save on currency, travel cards, overseas spending and managing money when you go abroad from the UK."},"money-saving/everyday-money":{title:"Everyday Money",desc:"Day-to-day money tips for UK households — bank accounts, budgeting, subscriptions and small wins that add up."},"money-saving/credit-score":{title:"Credit Score",desc:"Improve your UK credit score — check your file, fix errors, build credit history and unlock better rates on borrowing."},"money-saving/wills-and-probate":{title:"Wills & Probate",desc:"UK guides on writing a will, dealing with probate, inheritance tax and protecting your estate for your loved ones."},"money-saving/utilities":{title:"Utilities",desc:"Cut your gas, electric, water and broadband bills with UK utility guides — switching, fixed tariffs and energy efficiency."}};function S(t){return t.split("-").filter(Boolean).map(r=>r[0]?.toUpperCase()+r.slice(1)).join(" ")}function G(t){const i=t.replace(/^\//,"").replace(/\/$/,"").split("/").filter(Boolean),a=S(i[i.length-1]||"")||"Explore",n=i.length>1?S(i[0]):"",d=n?`Browse ${a} guides in our ${n} section on Compare UK Quotes — practical UK advice, explainers and money-saving tips.`:`Browse ${a} guides on Compare UK Quotes — practical UK advice, explainers and money-saving tips for everyday decisions.`;return{title:a,description:d}}function k(t){return t.replace(/\/+$/g,"").replace(/^\/+/,"")}
1function J(t,r){const a=k(r).split("/").filter(Boolean);let n,d=t;for(const h of a){if(n=d.find(p=>p.slug===h),!n)return;d=n.sections??[]}return n}function V(t){return"/"+t.replace(/https?:\/\/[^\/]+\/?/,"").replace(/\/$/,"")}function W({page:t,featured:r=!1}){const i=t.url.replace(/https?:\/\/[^\/]+\/?/,"").replace(/\/$/,"")||"index",a=V(t.url),n=t.heroImage||t.firstImage||O(t.url);return r?e.jsx(v,{href:a,"data-testid":`link-featured-page-${t.id}`,className:"group block col-span-full lg:col-span-2",children:e.jsx("div",{className:"relative overflow-hidden rounded-2xl border bg-card shadow-lg transition-all duration-300 group-hover:shadow-xl group-hover:-translate-y-1",children:e.jsxs("div",{className:"grid lg:grid-cols-2",children:[e.jsxs("div",{className:"relative aspect-[16/10] lg:aspect-auto overflow-hidden",children:[e.jsx("img",{src:n,alt:t.title||i,loading:"lazy",decoding:"async",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"}),e.jsx("div",{className:"absolute top-4 left-4",children:e.jsx("span",{className:"px-3 py-1 bg-blue-600 text-white text-xs font-semibold rounded-full",children:"Featured"})})]}),e.jsxs("div",{className:"p-6 lg:p-8 flex flex-col justify-center",children:[e.jsx("h3",{className:"text-xl lg:text-2xl font-bold leading-tight line-clamp-3 mb-3",style:{fontFamily:"var(--font-heading)"},children:t.title||i}),e.jsx("p",{className:"text-muted-foreground line-clamp-3 mb-4",children:t.metaDescription||"Discover helpful tips and expert guidance in this comprehensive guide."}),e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-blue-600",children:[e.jsx("span",{children:"Read full article"}),e.jsx($,{className:"h-4 w-4 transition-transform duration-200 group-hover:translate-x-1"})]})]})]})})}):e.jsx(v,{href:a,"data-testid":`link-cached-page-${t.id}`,className:"group block",children:e.jsxs("div",{className:"relative h-full overflow-hidden rounded-xl border bg-card shadow-sm transition-all duration-300 group-hover:shadow-md group-hover:-translate-y-0.5",children:[e.jsxs("div",{className:"relative aspect-[16/10] overflow-hidden",children:[e.jsx("img",{"data-testid":`img-cached-page-${t.id}`,src:n,alt:t.title||i,loading:"lazy",decoding:"async",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-black/10 to-transparent"}),e.jsx("div",{className:"absolute bottom-3 left-3 right-3",children:e.jsx("span",{className:"inline-block px-2 py-0.5 bg-white/90 backdrop-blur text-xs font-medium rounded",children:"Guide"})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{"data-testid":`text-cached-page-title-${t.id}`,className:"text-base font-semibold leading-snug line-clamp-2 mb-2",style:{fontFamily:"var(--font-heading)"},children:t.title||i}),e.jsx("p",{"data-testid":`text-cached-page-desc-${t.id}`,className:"line-clamp-2 text-sm text-muted-foreground mb-3",children:t.metaDescription||"View this helpful guide"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-blue-600 group-hover:text-blue-700",children:[e.jsx("span",{children:"Read more"}),e.jsx($,{className:"h-3.5 w-3.5 transition-transform duration-200 group-hover:translate-x-0.5"})]})]})]})})}function ae({sections:t}){const[r]=F(),i=J(t,r),a=k(r),n=a.split("/")[0]||"",d=a.split("/").filter(Boolean),h=K[a]||(d.length===1?K[n]:void 0),p=G(`/${a}`),m=h?.title??i?.title??p.title,b=h?.desc??i?.description??p.description;B({title:m,description:b,canonical:M(`/${a}`)});const[f,I]=o.useState([]),[j,y]=o.useState(!0),[l,L]=o.useState(""),g=o.useRef(null),w=o.useRef(""),N=o.useCallback(s=>{if(!s.trim()||s===w.current)return;w.current=s;const u=localStorage.getItem("sessionId")||crypto.randomUUID();localStorage.setItem("sessionId",u),fetch("/api/search-log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({searchTerm:s.trim(),pageUrl:window.location.pathname,pageName:m,sessionId:u})}).catch(()=>{})},[m]);o.useEffect(()=>{a&&(y(!0),fetch(`/api/pages/section?path=${encodeURIComponent(a)}`,{cache:"no-store"}).then(s=>s.json()).then(s=>{I(Array.isArray(s)?s:[]),y(!1)}).catch(()=>y(!1)))},[a]),o.useEffect(()=>(g.current&&clearTimeout(g.current),l.trim().length>=2&&(g.current=setTimeout(()=>{N(l)},1500)),()=>{g.current&&clearTimeout(g.current)}),[l,N]);const x=o.useMemo(()=>{const s=l.trim().toLowerCase();return[...s?f.filter(c=>`${c.title??""} ${c.url??""} ${c.metaDescription??""}`.toLowerCase().includes(s)):f].sort((c,C)=>{const P=c.isFeatured?1:0;return(C.isFeatured?1:0)-P})},[f,l]);return e.jsxs("div",{className:"min-h-screen",children:[e.jsx(T,{}),e.jsxs("div",{className:"relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0",children:e.jsx("img",{src:R(a),alt:m,loading:"eager",decoding:"async",fetchPriority:"high",className:"w-full h-full object-cover opacity-20"})}),e.jsx("div",{className:"absolute inset-0 hero-glow"}),e.jsx("div",{className:"absolute inset-0 noise opacity-60"}),e.jsx("div",{className:"relative mx-auto max-w-6xl px-4 pb-8 pt-10 sm:pb-12 sm:pt-14",children:e.jsxs(q.div,{initial:{opacity:.9,y:3}
1,animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[e.jsx("h1",{"data-testid":"text-page-heading",className:"text-balance text-3xl font-extrabold leading-tight tracking-tight sm:text-4xl",style:{fontFamily:"var(--font-heading)"},children:m}),e.jsx("p",{"data-testid":"text-page-description",className:"mt-3 max-w-2xl text-pretty text-base text-foreground/75",children:b}),e.jsx("div",{className:"mt-6 grid gap-4 rounded-[calc(var(--radius)+14px)] border bg-card/80 p-4 shadow-soft backdrop-blur sm:grid-cols-[1fr_auto] sm:items-center",children:e.jsxs("div",{className:"relative",children:[e.jsx(U,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(H,{"data-testid":"input-search",placeholder:"Search pages","aria-label":"Search articles",className:"h-11 rounded-2xl pl-9",value:l,onChange:s=>L(s.target.value)})]})})]})})]}),e.jsxs("main",{id:"main-content",className:"mx-auto max-w-6xl px-4 pb-14",children:[i?.sections?.length?e.jsxs("div",{className:"mt-8",children:[e.jsx("div",{"data-testid":"text-subsections",className:"text-sm font-semibold text-muted-foreground",children:"Subsections"}),e.jsx("div",{className:"mt-3 grid gap-3 md:grid-cols-3",children:(i.sections??[]).map(s=>e.jsxs(v,{href:`${r.replace(/\/+$/,"")}/${s.slug}`,"data-testid":`card-subsection-${s.slug}`,className:"group relative overflow-hidden rounded-[calc(var(--radius)+12px)] border bg-white/70 p-5 transition-transform duration-300 hover:-translate-y-0.5",children:[e.jsx("div",{className:"absolute -inset-16 opacity-60 hero-glow"}),e.jsx("div",{className:"absolute inset-0 noise opacity-35"}),e.jsxs("div",{className:"relative flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{"data-testid":`text-subsection-title-${s.slug}`,className:"text-base font-extrabold",style:{fontFamily:"var(--font-heading)"},children:s.title}),e.jsx("div",{"data-testid":`text-subsection-desc-${s.slug}`,className:"mt-1 text-sm text-muted-foreground",children:s.description??"Browse this category"})]}),e.jsx(D,{className:"h-5 w-5 opacity-30 transition-opacity group-hover:opacity-80"})]})]},s.slug))})]}):null,e.jsxs("div",{className:"mt-10",children:[e.jsx("div",{"data-testid":"text-pages",className:"text-sm font-semibold text-muted-foreground",children:j?"Loading...":`${x.length} Articles`}),j?e.jsxs("div",{className:"mt-8 flex items-center justify-center gap-3 text-muted-foreground py-12",children:[e.jsx(Q,{className:"h-6 w-6 animate-spin"}),e.jsx("span",{children:"Loading articles..."})]}):x.length?e.jsx("div",{className:"mt-4 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:x.map((s,u)=>e.jsx(W,{page:s,featured:f.some(c=>c.isFeatured)?!!s.isFeatured&&u===0:u===0&&x.length>3},s.id))}):e.jsxs(E,{className:"mt-4 p-8 text-center bg-slate-50",children:[e.jsx(U,{className:"h-12 w-12 mx-auto text-slate-300 mb-4"}),e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No articles found"}),e.jsx("p",{"data-testid":"text-empty",className:"text-muted-foreground mb-4",children:l?"Try a different search term":"This section has no articles yet."}),e.jsx(z,{asChild:!0,variant:"outline",children:e.jsx(v,{href:"/",children:"Browse all categories"})})]})]})]}),e.jsx(A,{})]})}export{ae as default};

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.