1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9309],{2386:(e,t,r)=>{"use strict";r.d(t,{Ix:()=>i,j$:()=>c,kn:()=>a});var n=r(2009),s=r(8032);async function i(e,t){let r=(0,n.rJ)((0,s.s$)(),"customers",e,"orders");return(await (0,n.GG)((0,n.P)(r,(0,n._M)("siteCode","==",t),(0,n.My)("placedAt","desc")))).docs.map(e=>{var t;let r=e.data();return{orderToken:String(r.orderToken??e.id),invoiceNumber:String(r.invoiceNumber??""),placedAt:(t=r.placedAt)&&"object"==typeof t&&"function"==typeof t.toDate?t.toDate().toISOString():"string"==typeof t?t:null,siteCode:String(r.siteCode??""),status:String(r.status??""),total:"number"==typeof r.total?r.total:0,currency:String(r.currency??"GBP"),itemCount:"number"==typeof r.itemCount?r.itemCount:0,primaryItemName:"string"==typeof r.primaryItemName?r.primaryItemName:null}})}async function a(e,t){let r=await fetch(`/api/app/customers/orders/${encodeURIComponent(e)}`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},cache:"no-store"});if(404===r.status)return null;if(!r.ok)throw Error(`Could not load the order (HTTP ${r.status}).`);return await r.json()}async function c(e,t){let r=await fetch(`/api/app/customers/orders/${encodeURIComponent(e)}/reorder`,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},cache:"no-store"});if(!r.ok)throw Error(`Reorder failed (HTTP ${r.status}).`);return await r.json()}},2391:(e,t,r)=>{"use strict";r.d(t,{_:()=>d});var n=r(7876),s=r(4232),i=r(8230),a=r.n(i),c=r(9099),o=r(282);let l=[{label:"Place a new order",href:"/menu",icon:(0,n.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:"size-5 shrink-0","aria-hidden":!0,children:[(0,n.jsx)("path",{d:"M12 5v14"}),(0,n.jsx)("path",{d:"M5 12h14"})]})},{activeKey:"orders",label:"Previous orders",href:"/account/orders",icon:(0,n.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:"size-5 shrink-0","aria-hidden":!0,children:[(0,n.jsx)("path",{d:"M4 7h16"}),(0,n.jsx)("path",{d:"M5 7l1.2 11.1A2 2 0 0 0 8.2 20h7.6a2 2 0 0 0 2-1.9L19 7"}),(0,n.jsx)("path",{d:"M9 7V5a3 3 0 0 1 6 0v2"})]})},{activeKey:"details",label:"My details",href:"/account/contact-details",icon:(0,n.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:"size-5 shrink-0","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"12",cy:"8",r:"3.5"}),(0,n.jsx)("path",{d:"M5 20c1.4-3.4 4-5 7-5s5.6 1.6 7 5"})]})}];function d({active:e,displayName:t,phoneOverride:r,children:i}){let d=(0,c.useRouter)(),{user:u,signOut:x}=(0,o.t)(),h=r??u?.phoneNumber??"",p=t?.trim()||"Your account",f=(0,s.useCallback)(async()=>{try{await x()}finally{await d.replace("/sign-in")}},[x,d]);return(0,n.jsx)("div",{className:"min-h-[80vh] bg-zinc-50 px-4 py-10 sm:py-14",children:(0,n.jsxs)("div",{className:"mx-auto w-full max-w-6xl",children:[(0,n.jsxs)("div",{className:"grid gap-6 lg:grid-cols-[300px_1fr] lg:gap-10",children:[(0,n.jsxs)("aside",{className:"lg:sticky lg:top-24 lg:self-start",children:[(0,n.jsx)(m,{phone:h,name:p}),(0,n.jsx)("nav",{"aria-label":"Account sections",className:"mt-4 hidden lg:block",children:(0,n.jsx)("ul",{className:"space-y-2",children:l.map(t=>{let r=!!t.activeKey&&e===t.activeKey;return(0,n.jsx)("li",{children:(0,n.jsxs)(a(),{href:t.href,"aria-current":r?"page":void 0,className:`flex items-center gap-3 rounded-2xl border px-4 py-3 text-sm font-semibold transition ${r?"border-zinc-700 bg-zinc-700 text-white":"border-zinc-200 bg-white text-zinc-900 hover:border-zinc-700 hover:bg-zinc-700 hover:text-white"}`,children:[t.icon,(0,n.jsx)("span",{children:t.label})]})},t.label)})})}),(0,n.jsx)("nav",{"aria-label":"Account sections",className:"-mx-1 mt-4 flex gap-2 overflow-x-auto px-1 pb-1 lg:hidden",children:l.map(t=>{let r=!!t.activeKey&&e===t.activeKey;return(0,n.jsxs)(a(),{href:t.href,"aria-current":r?"page":void 0,className:`inline-flex shrink-0 items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition ${r?"border-zinc-700 bg-zinc-700 text-white":"border-zinc-200 bg-white text-zinc-900 hover:border-zinc-700 hover:bg-zinc-700 hover:text-white"}`,children:[t.icon,(0,n.jsx)("span",{children:t.label})]},t.label)})}),(0,n.jsx)("div",{className:"mt-4 hidden border-t border-zinc-200 pt-4 lg:block",children:(0,n.jsxs)("button",{type:"button",onClick:()=>void f(),className:"flex w-full items-center gap-3 rounded-2xl border border-transparent px-4 py-3 text-sm font-semibold text-zinc-500 transition hover:border-zinc-700 hover:bg-zinc-700 hover:text-white",children:[(0,n.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:"size-5 shrink-0","aria-hidden":!0,
1children:[(0,n.jsx)("path",{d:"M15 17l5-5-5-5"}),(0,n.jsx)("path",{d:"M20 12H9"}),(0,n.jsx)("path",{d:"M9 21H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3"})]}),"Sign out"]})})]}),(0,n.jsx)("main",{className:"min-w-0",children:i})]}),(0,n.jsx)("div",{className:"mt-8 flex justify-center lg:hidden",children:(0,n.jsx)("button",{type:"button",onClick:()=>void f(),className:"inline-flex items-center gap-2 text-sm font-semibold text-zinc-500 underline",children:"Sign out"})})]})})}function m({phone:e,name:t}){return(0,n.jsxs)("div",{className:"rounded-[1.75rem] bg-zinc-700 px-5 py-5 text-white shadow-[0_18px_38px_-26px_rgba(0,0,0,0.32)]",children:[(0,n.jsx)("p",{className:"text-[0.65rem] font-semibold uppercase tracking-[0.26em] text-zinc-300",children:"Signed in as"}),e?(0,n.jsx)("p",{className:"mt-1 text-[1.4rem] font-bold tracking-tight tabular-nums text-white","aria-label":`Phone number ${e}`,children:e}):(0,n.jsx)("p",{className:"mt-1 text-[1.2rem] font-bold tracking-tight text-white",children:t}),e&&t&&"Your account"!==t?(0,n.jsx)("p",{className:"mt-1 text-sm text-zinc-200",children:t}):null]})}},4667:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>p,default:()=>f});var n=r(7876),s=r(4232),i=r(7328),a=r.n(i),c=r(8230),o=r.n(c),l=r(9099),d=r(282),m=r(1872),u=r(2386),x=r(2391),h=r(5046),p=!0;function f({siteCode:e}){let t=(0,l.useRouter)(),{user:r,loading:i}
1=(0,d.t)(),[c,p]=(0,s.useState)(null),[f,b]=(0,s.useState)(null);if((0,s.useEffect)(()=>{i||r||t.replace("/sign-in")},[i,r,t]),(0,s.useEffect)(()=>{if(!r)return;let t=!0;return(0,m.Qx)(r.uid).then(e=>{t&&p(e)}).catch(()=>{t&&p(null)}),(0,u.Ix)(r.uid,e).then(e=>{t&&b(e)}).catch(()=>{t&&b([])}),()=>{t=!1}},[r,e]),i||!r)return(0,n.jsx)("div",{className:"min-h-[60vh] bg-zinc-50 px-4 py-16 text-center",children:(0,n.jsx)("p",{className:"text-zinc-600",children:"Loading your account..."})});let g=(f??[]).slice(0,3);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(),{children:[(0,n.jsx)("title",{children:"My account"}),(0,n.jsx)("meta",{name:"robots",content:"noindex,nofollow"})]}),(0,n.jsxs)(x._,{active:null,displayName:c?.displayName??null,phoneOverride:c?.phone??null,children:[(0,n.jsxs)("header",{children:[(0,n.jsx)("p",{className:"text-[0.7rem] font-semibold uppercase tracking-[0.26em] text-zinc-500",children:0===g.length?"Welcome":"Welcome back"}),(0,n.jsx)("h1",{className:"mt-2 text-[2rem] font-bold tracking-tight text-zinc-900",children:c?.displayName?.trim()||"Your account"}),g.length>0?(0,n.jsx)("p",{className:"mt-2 max-w-prose text-sm leading-6 text-zinc-600",children:"Reorder a favourite, update where we deliver, or jump back to the menu."}):null]}),null===f?(0,n.jsx)("section",{className:"mt-8 rounded-[2rem] border border-zinc-200 bg-white px-6 py-6 sm:px-8",children:(0,n.jsx)("p",{className:"text-sm text-zinc-600",children:"Loading your orders..."})}):0===g.length?(0,n.jsxs)("section",{className:"mt-8 rounded-[2rem] border-2 border-zinc-900 bg-white px-6 py-8 sm:px-8 sm:py-10",children:[(0,n.jsx)("p",{className:"text-[0.7rem] font-semibold uppercase tracking-[0.26em] text-zinc-500",children:"Welcome"}),(0,n.jsx)("h2",{className:"mt-2 text-[1.75rem] font-bold tracking-tight text-zinc-900",children:"You're all set up"}),(0,n.jsx)("p",{className:"mt-2 text-sm leading-6 text-zinc-600",children:"Here's what your account gets you:"}),(0,n.jsx)("ul",{className:"mt-5 space-y-3",children:["Faster checkout â your address and details are saved","Exclusive offers and secret discount codes for signed-in customers","Reorder past orders in one tap","Order history with live tracking updates"].map(e=>(0,n.jsxs)("li",{className:"flex items-start gap-3",children:[(0,n.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"mt-0.5 size-5 shrink-0 text-zinc-900",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,n.jsx)("path",{d:"M8 12.5l2.5 2.5L16 9.5"})]}),(0,n.jsx)("span",{className:"text-sm leading-6 text-zinc-700",children:e})]},e))}),(0,n.jsx)(o(),{href:"/menu",className:"mt-7 inline-flex min-h-12 w-full items-center justify-center rounded-full border border-zinc-900 bg-zinc-900 px-6 text-base font-semibold text-white transition hover:bg-white hover:text-zinc-900 sm:w-auto",children:"Browse the menu â"})]}):(0,n.jsxs)("section",{className:"mt-8",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("h2",{className:"text-xl font-bold tracking-tight text-zinc-900",children:"Recent orders"}),(0,n.jsx)(o(),{href:"/account/orders",className:"text-sm font-semibold text-zinc-900 underline-offset-2 hover:underline",children:"View all"})]}),(0,n.jsx)("ul",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2",children:g.slice(0,2).map(t=>(0,n.jsx)("li",{children:(0,n.jsx)(h.B,{order:t,siteCode:e})},t.orderToken))})]})]})]})}},5033:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/account",function(){return r(4667)}])},5046:(e,t,r)=>{"use strict";r.d(t,{B:()=>l});var n=r(7876),s=r(4587),i=r.n(s),a=r(8230),c=r.n(a),o=r(3720);function l({order:e,siteCode:t}){var r,s,a;let l=(0,o.sk)(t),d=function(e){if(!e)return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let r=t.toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}),n=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return`${r}, ${n}`}(e.placedAt);return(0,n.jsxs)(c(),{href:`/account/orders/${encodeURIComponent(e.orderToken)}`,className:"group flex h-full flex-col items-center rounded-3xl border-2 border-black bg-transparent p-4 transition hover:bg-black/[0.04] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2",children:[(0,n.jsx)("div",{className:"relative h-11 w-11",children:(0,n.jsx)(i(),{src:l.mobileLogo,alt:"",fill:!0,className:"object-contain",unoptimized:!0})}),(0,n.jsx)("div",{className:"mt-3 text-center text-base font-bold text-zinc-900",children:e.invoiceNumber||"Order"}),(0,n.jsx)("div",{className:"mt-1 text-center text-sm text-zinc-700",children:(r=e.itemCount,`${r} item${1===r?"":"s"}`)}),d?(0,n.jsx)("div",{className:"text-center text-sm text-zinc-500",children:d}):null,(0,n.jsxs)("div",{className:"mt-auto w-full pt-4",children:[(0,n.jsx)("div",{className:"h-px w-full bg-black"}),(0,n.jsx)("div",{className:"mt-3 text-center text-xl font-bold tracking-tight text-zinc-900 tabular-nums",children:(s=e.total,a=e.currency,new Intl.NumberFormat("en-GB",{style:"currency",currency:(a||"GBP").toUpperCase()}).format(s))}),(0,n.jsx)("div",{className:"mt-0.5 text-center text-xs capitalize text-zinc-500",children:e.status})]})]})}},7328:(e,t,r)=>{e.exports=r(8005)},9099:(e,t,r)=>{e.exports=r(7640)}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=5033)),_N_E=e.O()}]); 2//# sourceMappingURL=account-05cb4595a35f67f9.js.map
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.