PageSourceSearch

https://nwfloors.co.uk/assets/MyDeals-BV9nHEoW.js

js nwfloors.co.uk collected 2026-10-08 17:36:02 UTC 8,412 bytes, 6 lines download raw bytes

1import{h as v,j as e,r as y,B as c,I as C,u as q,L as p,b as L,a3 as S,ah as T,J as h,d as E,m as U}from"./index-D2rUcUpe.js";import{H as P}from"./Helmet-D7MYuSoa.js";import{u as R}from"./useMutation-N7h9ZAvw.js";import{C as d,a as x,b as u,c as o}from"./card-Bto263fv.js";import{L as F}from"./label-FpK1FRAL.js";import{T as b}from"./tag-s72l0Uly.js";import{L as k}from"./loader-circle-BLb9ftDd.js";import{C as M}from"./circle-alert-BOt0H_67.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const A=v("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);function B(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("token")}const N={pending:{label:"Awaiting our price",className:"bg-amber-100 text-amber-800"},replied:{label:"Price ready",className:"bg-green-100 text-green-800"},claimed:{label:"Ordered",className:"bg-gray-200 text-gray-700"},expired:{label:"Expired",className:"bg-gray-200 text-gray-600"},closed:{label:"Closed",className:"bg-gray-200 text-gray-600"}};
6function w(s){if(!s)return null;const t=new Date(s);return isNaN(t.getTime())?null:t.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}function D({children:s}){return e.jsxs("div",{className:"min-h-screen bg-gray-50 py-12 px-4",children:[e.jsxs(P,{children:[e.jsx("title",{children:"My deal requests — Northwest Floors"}),e.jsx("meta",{name:"robots",content:"noindex"})]}),e.jsx("div",{className:"max-w-2xl mx-auto",children:s})]})}function H(){var m;const[s,t]=y.useState(""),[l,r]=y.useState(!1),a=R({mutationFn:n=>L("/api/deals/mine/request-link",{method:"POST",data:{email:n}}),onSuccess:()=>r(!0)}),i=n=>{n.preventDefault(),s.trim()&&a.mutate(s.trim())};return l?e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-5 w-5 text-green-600"})," Check your inbox"]})}),e.jsxs(o,{className:"space-y-4",children:[e.jsxs("p",{className:"text-gray-600",children:["If we have any deal requests linked to ",e.jsx("strong",{children:s}),", we've emailed you a secure link to view them. It can take a minute or two to arrive — remember to check your spam folder."]}),e.jsx(c,{variant:"outline",onClick:()=>r(!1),children:"Use a different email"})]})]}):e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary mb-1",children:[e.jsx(b,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-semibold uppercase tracking-wide",children:"Your deal requests"})]}),e.jsx(u,{children:"Find your price"})]}),e.jsxs(o,{children:[e.jsx("p",{className:"text-gray-600 mb-5",children:"Asked us for a deal on a product? Enter the email you used and we'll send you a secure link to view all your requests and any prices we've sent back."}),e.jsxs("form",{onSubmit:i,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:"lookup-email",children:"Email address"}),e.jsx(C,{id:"lookup-email",type:"email",required:!0,placeholder:"[email protected]",value:s,onChange:n=>t(n.target.value)})]}),a.isError&&e.jsx("p",{className:"text-sm text-red-600",children:((m=a.error)==null?void 0:m.message)||"Something went wrong — please try again."}),e.jsx(c,{type:"submit",className:"w-full",disabled:a.isPending,children:a.isPending?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"h-4 w-4 animate-spin mr-2"})," Sending…"]}):"Email me my link"})]})]})]})}function I({deal:s}){var j,g,f;const t=N[s.status]||N.pending,l=s.dealType==="best-price",r=s.listUnitPrice??null,a=s.agreedUnitPrice??null,i=r!=null&&a!=null?Math.max(0,Number((r-a).toFixed(2))):0,m=w(s.expiresAt),n=w(s.createdAt);return e.jsx(d,{children:e.jsx(o,{className:"p-4 sm:p-5",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-md overflow-hidden bg-gray-100 flex-shrink-0",children:(j=s.product)!=null&&j.imageUrl?e.jsx("img",{src:s.product.imageUrl,alt:s.product.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(S,{className:"h-5 w-5 text-gray-400"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:((g=s.product)==null?void 0:g.name)||"Product no longer available"}),e.jsx(T,{className:`${t.className} shrink-0`,variant:"secondary",children:t.label})]}),n&&e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["Requested ",n]}),s.status==="replied"&&a!=null&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[!l&&i>0&&r!=null&&e.jsxs("span",{className:"text-gray-400 line-through text-sm",children:[h(r),"/m²"]}),e.jsxs("span",{className:"text-lg font-bold text-primary",children:[h(a),"/m²"]}),l&&e.jsx("span",{className:"text-xs text-gray-500",children:"(our best price)"})]}),!l&&i>0&&e.jsxs("p",{className:"text-sm text-green-700 font-medium",children:["You save ",h(i),"/m²"]}),m&&e.jsxs("p",{className:"text-xs text-gray-500 mt-1 flex items-center gap-1",children:[e.jsx(E,{className:"h-3 w-3"})," Held until ",m]})]}),s.status==="pending"&&e.jsx("p",{className:"text-sm text-gray-600 mt-2",children:"We're working on your best price — usually within one working day."}),s.status==="expired"&&e.jsx("p",{className:"text-sm text-gray-600 mt-2",children:"This price offer has expired. Request a fresh price and we'll get a new deal over to you."}),s.status==="claimed"&&e.jsxs("p",{className:"text-sm text-gray-600 mt-2 flex items-center gap-1",children:[e.jsx(U,{className:"h-4 w-4 text-green-600"})," You've ordered using this deal."]}),s.staffNote&&s.status==="replied"&&e.jsx("div",{className:"mt-3 bg-gray-50 border rounded-md p-3 text-sm text-gray-700 whitespace-pre-wrap",children:s.staffNote}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[s.status==="replied"&&s.claimUrl&&e.jsx(c,{asChild:!0,size:"sm",children:e.jsx("a",{href:s.claimUrl,children:"Claim this deal"})}),(s.status==="expired"||s.status==="claimed")&&((f=s.product)==null?void 0:f.slug)&&e.jsx(c,{asChild:!0,size:"sm",variant:"outline",children:e.jsx(p,{href:`/product/${s.product.slug}`,children:"View product"})})]})]})]})})})}function Y({token:s}){const{data:t,isLoading:l,isError:r,error:a}=q({queryKey:[`/api/deals/mine?token=${encodeURIComponent(s)}`]});return l?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-500",children:[e.jsx(k,{className:"h-8 w-8 animate-spin mb
6-3"}),e.jsx("p",{children:"Loading your deal requests…"})]}):r?e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(M,{className:"h-5 w-5 text-amber-600"})," Link expired"]})}),e.jsxs(o,{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600",children:(a==null?void 0:a.message)||"This link is invalid or has expired. Request a fresh one below."}),e.jsx(c,{asChild:!0,children:e.jsx(p,{href:"/deals/mine",children:"Get a new link"})})]})]}):!t||t.length===0?e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"No deal requests yet"})}),e.jsxs(o,{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600",children:"We couldn't find any deal requests linked to this email. Browse our range and ask us for a price on anything you like."}),e.jsx(c,{asChild:!0,children:e.jsx(p,{href:"/shop",children:"Browse flooring"})})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary mb-1",children:[e.jsx(b,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-semibold uppercase tracking-wide",children:"Your deal requests"})]}),e.jsx("h1",{className:"text-2xl font-bold",children:"Your prices in one place"}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Here's every deal you've asked us about. When a price is ready, claim it in a couple of clicks."})]}),t.map(i=>e.jsx(I,{deal:i},i.id))]})}function Q(){const s=B();return e.jsx(D,{children:s?e.jsx(Y,{token:s}):e.jsx(H,{})})}export{Q 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.