PageSourceSearch

https://www.uswitch.com/fs-frontend-assets/index-BCXjf0co.js

js uswitch.com collected 2026-09-24 08:49:46 UTC 6,775 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./components-CpRQf-dN.js";import{I as M}from"./window-data-D2p09VOK.js";import"./tracking-CY6Q8RVS.js";import"./errorBoundaries-DRzwUlCV.js";import"./src-DJ4oPj6b-BJuKX68Q.js";import"./index-De-iH0Ei.js";import"./schemas-PxLoeS90.js";const T=s=>Math.round(s*100)/100,C=Intl.NumberFormat("en-UK",{minimumFractionDigits:0}),U=Intl.NumberFormat("en-UK",{minimumFractionDigits:2}),w=s=>s%1===0?C.format(T(s)):U.format(T(s)),O=({amount:s,apr:u,duration:x})=>{const d=s,i=u/100/12,c=x*12,p=Math.pow(1+i,c),n=d*p*i/(p-1);return!Number.isNaN(n)&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY?{monthlyPayment:w(n),total:w(n*c),totalInterest:w(n*c-d)}:{monthlyPayment:"0",total:"0",totalInterest:"0"}},L=s=>C.format(s),v="w-full mb-2 font-heading font-bold text-[18px] leading-[120%] text-grey80",I="w-full bg-white box-border p-4 rounded font-body text-[16px] font-semibold leading-[133%] border border-grey40 focus:outline-none focus:border-accent",f="text-center m-0 text-[30px] text-white",N="text-center m-0 text-[14px] text-grey10",b="bg-cta-secondary text-white text-center rounded-cta px-5 py-3 text-[16px] flex-grow no-underline",g="text-[18px] mb-1 first-of-type:mt-0",j="text-[14px] font-extralight m-0",W=()=>{const[s,u]=l.useState(7500),[x,d]=l.useState(5),[i,c]=l.useState(3.7),[p,n]=l.useState("7,500"),[F,A]=l.useState("5"),[_,S]=l.useState("3.7"),{monthlyPayment:E,total:k,totalInterest:P}=l.useMemo(()=>O({amount:s,apr:i,duration:x}),[s,i,x]),B=o=>{const t=o.target.value.replace(/\D/g,""),a=t===""?0:parseInt(t,10);n(t===""?"":L(a)),u(a)},D=o=>{const t=o.target.value.replace(/\D/g,""),a=t===""?0:parseInt(t,10);A(t),d(a)},R=o=>{const a=o.target.value.replace(/[^\d.]/g,"").split(".").slice(0,2).join("."),h=a===""||a==="."?0:parseFloat(a);S(a),c(Number.isNaN(h)?0:h)},y=(o,t,a)=>h=>{let r=h.target.value;if(r===""){o("0"),t(0);return}if(r.endsWith(".")){r=r.replace(/\.$/,"");const m=parseFloat(r);o(r),t(Number.isNaN(m)?0:m);return}if(a){const m=r.replace(/\D/g,"");m!==""&&o(a(parseInt(m,10)))}};return e.jsxs("div",{className:"bg-white p-5 rounded-xl md:rounded-3xl border border-accent shadow-lg",children:[e.jsxs("div",{className:"flex flex-col justify-between md:flex-row md:gap-4 md:items-stretch",children:[e.jsxs("div",{className:"flex flex-col mb-4 md:mb-0 md:flex-1",children:[e.jsx("label",{htmlFor:"loan-amount",className:v,children:"I wish to borrow:"}),e.jsxs("div",{className:"relative w-full",children:[e.jsx("span",{className:"absolute top-4 left-4",children:"£"}),e.jsx("input",{id:"loan-amount",name:"loan-amount",type:"text",inputMode:"numeric",className:`${I} pl-14`,value:p,onChange:B,onBlur:y(n,u,L)})]})]}),e.jsxs("div",{className:"flex flex-col mb-4 md:mb-0 md:flex-1",children:[e.jsx("label",{htmlFor:"loan-duration",className:v,children:"over:"}),e.jsxs("div",{className:"relative w-full",children:[e.jsx("input",{id:"loan-duration",name:"loan-duration",type:"text",inputMode:"numeric",className:`${I} pr-8`,value:F,onChange:D,onBlur:y(A,d)}),e.jsx("span",{className:"absolute top-4 right-4",children:" years"})]})]}),e.jsxs("div",{className:"flex flex-col mb-4 md:mb-0 md:flex-1",children:[e.jsx("label",{htmlFor:"loan-apr",className:v,children:"at an APR of:"}),e.jsxs("div",{className:"relative w-full",children:[e.jsx("input",{id:"loan-apr",name:"loan-apr",type:"text",inputMode:"decimal",className:`${I} pr-8`,value:_,onChange:R,onBlur:y(S,c)}),e.jsx("span",{className:"absolute top-4 right-4",children:"%"})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-center text-[14px]",children:"The costs below are for illustrative purposes. Check the exact amounts with the lender when you decide on a loan."}),e.jsxs("div",{className:"flex flex-col md:flex-row md:mb-2",children:[e.jsxs("div",{className:"bg-surface-inverse p-2 md:flex-1 md:rounded-tl-lg",children:[e.jsx("p",{className:N,children:"A monthly payment of:"}),e.jsxs("p",{className:f,children:["£",E]})]}),e.jsxs("div",{className:"bg-[#5d6a72] p-2 md:flex-1 md:rounded-tr-lg",children:[e.jsx("p",{className:N,children:"Total cost of credit:"}),e.jsxs("p",{className:f,children:["£",P]})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row",children:[e.jsxs("div",{className:"bg-surface-inverse p-2 md:flex-1 md:rounded-bl-lg",children:[e.jsx("p",{className:N,children:"based on an APR of:"}),e.jsxs("p",{className:f,children:[i,"%"]})]}),e.jsxs("div",{className:"bg-[#5d6a72] p-2 md:flex-1 md:rounded-br-lg",children:[e.jsx("p",{className:N,children:"That's a total of:"}),e.jsxs("p",{className:f,children:["£",k]})]})]})]}),e.jsx("p",{className:"text-center text-[20px]",children:"Find a loan now"}),e.jsxs("div",{className:"flex flex-col justify-around mb-4 gap-4 md:flex-row",children:[e.jsx("a",{href:"/loans/unsecured-loans",className:b,children:"Personal"}),e.jsx("a",{href:"/loans/bad-credit-loans",className:b,children:"Bad Credit"}),e.jsx("a",{href:"/loans/guarantor-loans",className:b,children:"Guarantor"}),e.jsx("a",{href:"/business/business-loans",className:b,children:"Business"})]}),e.jsxs("details",{className:"group",children:[e.jsxs("summary",{className:"list-none text-center flex items-center justify-center cursor-pointer gap-2 underline text-grey80 [&::-webkit-details-marker]:hidden",children:["Unsure on which type of loan you're after?",e.jsx(M,{glyph:"chevron-down",color:"currentColor",size:"small",ariaLabel:"",className:"group-open:rotate-180 transition-transform"})]}),e.jsxs("div",{className:"bg-[#5d6a72] text-white p-4 mt-4 rounded-b-xl",children:[e.jsx("p",{className:g,children:"Personal loans"}
1),e.jsx("p",{className:j,children:"A personal loan is a type of unsecured loan, which means what you borrow isn't secured against any asset like your home. You borrow a fixed amount and pay it back plus interest over a set period."}),e.jsx("p",{className:g,children:"Bad credit loans"}),e.jsx("p",{className:j,children:"If you have a poor credit history, you could still borrow money with a bad credit loan. They can help you improve your credit rating if you keep up with repayments, but they usually come with a high APR."}),e.jsx("p",{className:g,children:"Guarantor loans"}),e.jsx("p",{className:j,children:"A guarantor loan works by appointing someone else, like a parent or friend, to make your loan repayments if you're unable to. You could get a guarantor loan if you have a poor credit record, or if you've not borrowed before."}),e.jsx("p",{className:g,children:"Business loans"}),e.jsx("p",{className:j,children:"This type of loan can only be used for business purposes and it must be paid back over time, with interest. For example, a business loan can be used for hiring more staff, buying equipment, marketing and improving cash flow."})]})]})]})};export{W 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.