PageSourceSearch

https://quotecam.ai/assets/chargy-usage-BgyLuFYg.js

js quotecam.ai collected 2026-10-05 15:25:44 UTC 6,438 bytes, 1 lines download raw bytes

1import{r as l,j as e,aJ as f}from"./index-BvSdsJgV.js";import{C as x}from"./CfrPayoutNotice-CWMJeXLp.js";import{S as h}from"./shield-check-Iv7cP98J.js";import"./info-DbtR8wO5.js";import"./circle-check-CaEehVFn.js";const g=t=>new Date(`${t}-01T12:00:00Z`).toLocaleDateString("en-CA",{month:"long",year:"numeric",timeZone:"UTC"}),u=(t,r=2)=>t.toLocaleString("en-CA",{style:"currency",currency:"CAD",minimumFractionDigits:2,maximumFractionDigits:r});function k(){const[t,r]=l.useState(null),[i,c]=l.useState(!0),[p,d]=l.useState(!1),[n,j]=l.useState("all"),m=(t==null?void 0:t.chargers)??(t?[{...t.charger,months:t.months}]:[]),b=m.map((s,a)=>({...s,index:a})).filter(s=>n==="all"||String(s.index)===n);return l.useEffect(()=>{document.title="Energy Usage | Chargy";const s=document.createElement("meta");s.name="referrer",s.content="no-referrer",document.head.appendChild(s);const a=window.location.hash.startsWith("#")?window.location.hash.slice(1):"";return a?(fetch("/api/public/chargy/usage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:a}),cache:"no-store",referrerPolicy:"no-referrer"}).then(async o=>{if(!o.ok)throw new Error("Unavailable");return o.json()}).then(r).catch(()=>d(!0)).finally(()=>c(!1)),()=>s.remove()):(d(!0),c(!1),()=>s.remove())},[]),e.jsxs("main",{className:"min-h-screen bg-slate-50 text-slate-900",children:[e.jsx("header",{className:"border-b border-slate-200 bg-white",children:e.jsxs("div",{className:"mx-auto flex max-w-4xl items-center gap-3 px-5 py-5",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-[#2F9EBC] text-white",children:e.jsx(f,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl font-bold",children:"Chargy"}),e.jsx("p",{className:"text-sm text-slate-500",children:"CFR energy usage"})]})]})}),e.jsxs("section",{className:"mx-auto max-w-4xl px-5 py-10 sm:py-14",children:[i&&e.jsxs("div",{className:"space-y-4","aria-label":"Loading energy usage",children:[e.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-slate-200"}),e.jsx("div",{className:"h-28 animate-pulse rounded-2xl bg-white"}),e.jsx("div",{className:"h-40 animate-pulse rounded-2xl bg-white"})]}),!i&&p&&e.jsxs("div",{className:"mx-auto max-w-lg rounded-2xl border border-slate-200 bg-white p-8 text-center shadow-sm",children:[e.jsx(h,{className:"mx-auto mb-4 h-10 w-10 text-slate-400"}),e.jsx("h1",{className:"text-xl font-semibold",children:"This usage page is unavailable"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-slate-500",children:"The private link may have been replaced or revoked. Please use the latest link from Chargy."})]}),!i&&t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("p",{className:"text-sm font-medium text-[#2789a3]",children:"Your energy history"}),e.jsxs("h1",{className:"mt-1 text-3xl font-bold tracking-tight",children:["Hello, ",t.customerFirstName]}),e.jsx("p",{className:"mt-2 text-slate-500",children:"Review your monthly charger usage and CFR payment details. The 100 kWh minimum applies to each charger separately."})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"charger-filter",className:"mb-2 block text-sm font-semibold",children:"View chargers"}),e.jsxs("select",{id:"charger-filter",value:n,onChange:s=>j(s.target.value),"data-testid":"select-customer-charger",className:"w-full rounded-lg border border-slate-300 bg-white px-3 py-3 text-sm sm:max-w-sm",children:[e.jsx("option",{value:"all",children:"All Chargers"}),m.map((s,a)=>e.jsx("option",{value:String(a),children:s.chargerId??`Charger ${a+1}`},a))]})]}),e.jsx("div",{className:"mb-6",children:e.jsx(x,{})}),b.map(s=>e.jsxs("section",{"aria-label":`Usage for ${s.chargerId??`Charger ${s.index+1}`}`,className:"mb-10",children:[e.jsx("h2",{className:"mb-3 text-xl font-bold",children:s.chargerId??`Charger ${s.index+1}`}),e.jsxs("div",{className:"mb-5 grid gap-4 rounded-2xl border border-slate-200 bg-white p-5 shadow-sm sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-slate-400",children:"Charger ID"}),e.jsx("p",{className:"mt-1 font-semibold",children:s.chargerId??"Not available"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-slate-400",children:"Model"}),e.jsx("p",{className:"mt-1 font-semibold",children:s.model??"Not available"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-slate-400",children:"Serial number"}),e.jsx("p",{className:"mt-1 font-mono text-sm font-semibold",children:s.serialNumber??"Not available"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Monthly usage"}),s.months.length===0?e.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-8 text-center text-slate-500",children:"Monthly usage will appear here after your first reporting period."}):s.months.map(a=>e.jsxs("article",{className:"rounded-2xl border border-slate-200 bg-white p-5 shadow-sm",children:[e.jsxs("div",{className:"flex flex-col justify-between gap-4 sm:flex-row sm:items-center",children:[e.jsx("div",{children:e.jsx("h3",{className:"font-semibold",children:g(a.month)})}),e.jsxs("dl",{className:"grid grid-cols-2 gap-x-8 gap-y-2 sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-slate-400",children:"Energy"}),e.jsxs("dd",{className:"mt-0.5 font-semibold",children:[a.kwh.toLocaleStr
1ing("en-CA",{maximumFractionDigits:2})," kWh"]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-slate-400",children:"Rate"}),e.jsx("dd",{className:"mt-0.5 font-semibold",children:a.rate===null?"—":`${u(a.rate,20)} / kWh`})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-slate-400",children:"Payment"}),e.jsx("dd",{className:"mt-0.5 font-semibold text-[#2789a3]",children:a.paymentAmount===null?"—":u(a.paymentAmount)})]})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(x,{kwh:a.kwh,monthLabel:g(a.month),previouslyNotifiedPayment:a.paymentNoticeSent&&(a.paymentAmount??0)>0})})]},a.month))]})]},s.index)),e.jsxs("p",{className:"mt-8 flex items-center justify-center gap-2 text-center text-xs text-slate-400",children:[e.jsx(h,{className:"h-4 w-4"})," This is your private, read-only Chargy usage page."]})]})]})]})}export{k 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.