1/*! For license information please see 4740.bbf7262c.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[4740],{4740(e,t,a){a.r(t),a.d(t,{default:()=>g});var s=a(5043),i=a(9970),c=a(1140),n=a(3390),l=(a(5949),a(5685)),r=a(2574),o=a(9233),d=a(5469);const h=(0,a(7784).A)("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);var x=a(2024),m=a(6210),p=a(7274),u=a(9722),f=a(6328),j=a(579);const N="https://plant4growthuk-production-a1cd.up.railway.app",g=()=>{const[e,t]=(0,s.useState)([]),[a,g]=(0,s.useState)(!0),k=(0,l.Zp)();(0,s.useEffect)(()=>{w()},[]);const w=async()=>{try{g(!0);const e=localStorage.getItem("elevate360_token"),a=await u.A.get("".concat(N,"/api/support/notifications"),{headers:{Authorization:"Bearer ".concat(e)}});t(a.data.notifications||[])}catch(e){console.error("Failed to fetch notifications:",e),f.oR.error("Failed to load notifications")}finally{g(!1)}},y=e=>{switch(e){case"ticket_reply":return(0,j.jsx)(r.A,{className:"w-5 h-5 text-purple-600"});case"ticket_created":return(0,j.jsx)(o.A,{className:"w-5 h-5 text-blue-600"});default:return(0,j.jsx)(o.A,{className:"w-5 h-5 text-slate-600"})}},v=e=>{switch(e){case"ticket_reply":return"bg-purple-100";case"ticket_created":return"bg-blue-100";default:return"bg-slate-100"}};return(0,j.jsx)(i.NI,{children:(0,j.jsxs)("div",{className:"space-y-6 max-w-3xl mx-auto",children:[(0,j.jsxs)("div",{className:"flex items-center justify-between",children:[(0,j.jsxs)("div",{className:"flex items-center gap-4",children:[(0,j.jsx)(n.$,{variant:"ghost",size:"icon",onClick:()=>k(-1),className:"text-slate-600",children:(0,j.jsx)(d.A,{className:"w-5 h-5"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("h1",{className:"text-2xl font-bold text-[#0D1B2A]","data-testid":"notifications-page-title",children:"Notifications"}),(0,j.jsx)("p",{className:"text-slate-500",children:e.length>0?"You have ".concat(e.length," unread notification").concat(e.length>1?"s":""):"All caught up!"})]})]}),e.length>0&&(0,j.jsxs)(n.$,{variant:"outline",onClick:async()=>{try{const a=localStorage.getItem("elevate360_token");await Promise.all(e.map(e=>u.A.put("".concat(N,"/api/support/notifications/").concat(e.notification_id,"/read"),{},{headers:{Authorization:"Bearer ".concat(a)}}))),t([]),f.oR.success("All notifications marked as read")}catch(a){f.oR.error("Failed to mark all as read")}},className:"flex items-center gap-2",children:[(0,j.jsx)(h,{className:"w-4 h-4"}),"Mark all as read"]})]}),(0,j.jsx)(c.Zp,{children:(0,j.jsx)(c.Wu,{className:"p-0",children:a?(0,j.jsx)("div",{className:"flex justify-center py-12",children:(0,j.jsx)(x.A,{className:"w-8 h-8 animate-spin text-[#41EAD4]"})}):0===e.length?(0,j.jsxs)("div",{className:"text-center py-16",children:[(0,j.jsx)(o.A,{className:"w-16 h-16 text-slate-300 mx-auto mb-4"}),(0,j.jsx)("h3",{className:"text-lg font-medium text-slate-700 mb-2",children:"No new notifications"}),(0,j.jsx)("p",{className:"text-slate-500",children:"You're all caught up! We'll notify you when something new happens."})]}):(0,j.jsx)("div",{className:"divide-y divide-slate-100",children:e.map(e=>(0,j.jsxs)("div",{className:"p-4 hover:bg-slate-50 transition-colors flex items-start gap-4","data-testid":"notification-".concat(e.notification_id),children:[(0,j.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 ".concat(v(e.type)),children:y(e.type)}),(0,j.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,j.jsx)("p",{className:"font-medium text-[#0D1B2A]",children:e.title}),(0,j.jsx)("p",{className:"text-sm text-slate-600 mt-1",children:e.message}),(0,j.jsx)("p",{className:"text-xs text-slate-400 mt-2",children:(0,p.m)(new Date(e.created_at),{addSuffix:!0})})]}),(0,j.jsx)("div",{className:"flex items-center gap-2",children:(0,j.jsx)(n.$,{variant:"ghost",size:"icon",onClick:()=>(async e=>{try{const a=localStorage.getItem("elevate360_token");await u.A.put("".concat(N,"/api/support/notifications/").concat(e,"/read"),{},{headers:{Authorization:"Bearer ".concat(a)}}),t(t=>t.filter(t=>t.notification_id!==e)),f.oR.success("Notification marked as read")}catch(a){f.oR.error("Failed to mark notification as read")}})(e.notification_id),className:"text-slate-400 hover:text-green-600",title:"Mark as read",children:(0,j.jsx)(m.A,{className:"w-4 h-4"})})})]},e.notification_id))})})})]})})}},5469(e,t,a){a.d(t,{A:()=>s});const s=(0,a(7784).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])}}]); 3//# sourceMappingURL=4740.bbf7262c.chunk.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.